5

When Scala plugin reimports an SBT project in IntelliJ IDEA, it changes the project's JDK to 1.6. Is it a way to choose which JDK version Scala plugin sets during reimport of the STB project.

Jacek L.
  • 1,376
  • 14
  • 19
  • What's the version of IDEA? What about SBT? What about `build.sbt`?What `SDKs` do you have in `Platform Settings` in IDEA? Can you check `Project SDK` in `Project` in `Project Settings` and ensure it's `1.7` or whatever name you gave for 7 or the expected version of JDK. – Jacek Laskowski Jan 29 '14 at 20:45
  • 2
    on SBT level you can set these JDK options `javacOptions in Compile ++= Seq("-source", "1.7", "-target", "1.7", "-Xlint:unchecked", "-Xlint:deprecation")` in settings. Maybe it will help IntelliJ to figure it out. – yǝsʞǝla Jan 29 '14 at 20:58
  • Good to hear that! I'll convert my comment to an answer then ;) – yǝsʞǝla Jan 30 '14 at 12:56

2 Answers2

3

You can set JDK options like these javacOptions in Compile ++= Seq("-source", "1.7", "-target", "1.7", "-Xlint:unchecked", "-Xlint:deprecation"), etc on SBT level in your project settings. It should help IntelliJ to use correct JDK version.

yǝsʞǝla
  • 16,272
  • 2
  • 44
  • 65
  • after making this change it may not be enough to just refresh from the SBT pane, I add to reimport it altogether – tekumara Jul 13 '16 at 05:01
  • This didn't work for me. I have those settings in my SBT, but when I re-import in IntelliJ, it resets the project to JDK 1.6 (the first in my list). :-( – Rich Oct 20 '16 at 14:52
1

Running sbt in the following way resolved it for me

sbt -java-home `/usr/libexec/java_home -v 1.7`
Tad
  • 838
  • 2
  • 11
  • 22