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: inProject 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.

4 comments
Official comment

It should be possible to simply choose desired JDK in Project Settings / Project / Project SDK.

I fixed it manually in idea project file. It seems that update of project setting doesn't affect file, only in memory state.

1

@Danila Thanks a lot! I've changed version in iml file and now it works for me as well

 

0

Pavel Fatin, it should be but when sbt project is refreshed setting returns to previous.

IntelliJ IDEA (Minerva) IU-145.844.1
Build #IU-145.844, built on April 5, 2016
JRE: 1.8.0_77-b03 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation

scala plugin version: 3.0.2

1

Please sign in to leave a comment.