With IntelliJ 2017.02.5, receiving error "Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK SBT: org.scala-lang:scala-library:2.11.10:jar"...
Creating a brand new Scala SBT project using IntelliJ 2017.2.5 (Scala Plugin 2017.2.11) is producing the following error when I attempt to compile a very simple:
"Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK SBT: org.scala-lang:scala-library:2.11.10:jar"
Without touching the default build.sbt file (leaving it just as it was when I created the project using the wizard), I create a package called "org.public_domain". I then use "New" to create a "Scala Class" named "Test" of type "object". I then fill in the body of the Object with a simple "val x = 1" assignment. When I select "Rebuild Project", I receive the above error.
The Parameters for the Scala SBT new project:
Name: Test
Location: ...
JDK: 1.8 (java version "1.8.0_144")
SBT: 1.0.2 (Sources unchecked)
Scala: Scala 2.11.10 (Sources checked)
Please sign in to leave a comment.
Please check this workaround: https://youtrack.jetbrains.com/issue/SCL-12736#comment=27-2487706
Happens with other Scala versions as well.
IntelliJ IDEA: 2017.2.5
Scala plugin: 2017.2.11
Exactly the same problem here (Intellij 2017.2.5 and scala plugin 2017.2.11):
Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK SBT: org.scala-lang:scala-library:2.11.8:jar
Can confirm on two platforms, Fedora 26 and MacOS. IntelliJ 2017.2.5 scala plugin 2017.2.11 across several scala versions. From what I can tell, and I'm no expert, it appears that the project structure is setup correctly.
One additional thing I noticed. When viewing the Models settings of a project that will run and one that will not I notice one big difference. New projects do not have a SBT tab.
Was able to resolve error by using a different version of the Java SDK.
On Fedora the native open JDK works just fine with sbt .13. This could be a java bug and not a IdeaJ bug. However, it would be nice to have a work around available via IntelliJ.
The workaround does not work for me as I must stick with 2.11.x. I have a library that has not been published for 2.12.x yet, so I am stuck on 2.11.x. Is there a workaround that doesn't involve going to 2.12.x?
Hey Jim,
I'm also using scala 2.11.x (2.11.11) and I am able to get things running as expected with sbt 0.13. The trick for me was to not run a java sdk (jdk) of version 9. Bump back down to version 8 of jdk and I think you'll be fine. I should also state that I'm using the open source java. http://openjdk.java.net/ It may be worth checking it out.
Okay. I just created a brand new project using SBT 0.13.16, and it appears to be working correctly on the test project (which is failing with the 1.0.2 version of SBT).
This was a problem with sbt 1.0.0 through 1.0.2, and should be fixed by upgrading the project to 1.0.3
I just corrected an error in my last comment where I had incorrectly cited SBT 1.0.3 when it was really 1.0.2.
I have now tried with Java 1.8, Scala 2.11.10 and SBT 1.0.3, and can confirm I am successfully completing the compilation when invoking the menu item "Build/Rebuild Project". Whoohoo! Tysvm for the fix.
I have lost at least 2 days of work to this issue as well. Even trying the "getting started with scala" steps fail for me.