Archeg
Archeg

Reputation: 8462

Refreshing SBT project in Intellij Idea switches Java to 7

I was having a Play 2.4.2 scala project built with J7 in IntelliJ Idea, then I switched the project to Play 2.5.0 with J8. I have modified J7->J8 everywhere I could think of, but for some reason, when I refresh project in SBT projects window in Intellij Idea (and it also refreshes it automatically when I change build.sbt), it sets Java version back to 7 (both options Project SDK and Project language level: in Project Structure window are set back)

I've probably missed some option, but I cannot find anything that still points to J7. Any idea?

I've tried to put this in build.sbt, but it did not fix the issue:

scalacOptions ++= Seq("-target:jvm-1.8")

Sbt compiles project fine if it is compiled SBT terminal, but I prefer to use IntelliJ Idea run option.

Upvotes: 4

Views: 374

Answers (2)

Justin Kaeser
Justin Kaeser

Reputation: 5948

We're looking into it. Meanwhile, one workaround is editing .idea/sbt.xml and change the jdk option line to <option name="jdk" value="1.8" /> (or whatever you named the SDK in your project structure) and then refreshing your project.

Update: The latest Nightlies of the Scala plugin change how the project JDK is set, which should solve this.

Upvotes: 2

Jeffrey Aguilera
Jeffrey Aguilera

Reputation: 1313

IntelliJ has a closed ticket for this issue: https://youtrack.jetbrains.com/issue/SCL-6823

I have created a new ticket: https://youtrack.jetbrains.com/issue/SCL-10631

Upvotes: 0

Related Questions