5

I'm trying to build a project with scala 2.11.7 in intellij. I've set the scalaVersion to 2.11.7, but when I check the external libraries, I can see scala-compiler:2.11.0.

Do I need to declare scala-compiler:2.11.7 as a dependency in build.sbt? The docs are confusing, seemingly saying that I do need to and then not to in consecutive paragraphs:

When using a Scala dependency other than the standard library, add it as a normal managed dependency. For example, to depend on the Scala compiler,

libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value

and

In order to compile Scala code, run scaladoc, and provide a Scala REPL, sbt needs the scala-compiler jar. This should not be a normal dependency of the project, so sbt adds a dependency on scala-compiler in the special, private scala-tool configuration.

So... should I add it or not?

jbrown
  • 7,518
  • 16
  • 69
  • 117

1 Answers1

3

If your project's code uses scala-compiler (e.g. to parse or compile Scala code, to run a REPL, etc.), add it. Otherwise, don't. That's why the first quote says "When using a Scala dependency other than the standard library..."

scala-compiler shown in External Libraries is probably there because one of your other dependencies depends on it (and that version was compiled with Scala 2.11.0).

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
  • So why am I seeing scala-compiler:2.11.0 in my external libs do you think? Is that jar actually being used to compile my project? I can see scala-library:2.11.7, so perhaps the compiler hasn't been updated since 2.11.0 (seems far-fetched)? – jbrown Oct 29 '15 at 12:55
  • See the edit (I actually added it before seeing your comment). – Alexey Romanov Oct 29 '15 at 13:03