Yuriy Yunikov Yuriy Yunikov - 24 days ago 7
Scala Question

Intellij IDEA: Scala 2.10 project with Java 7, UnsupportedClassVersionError

I'm trying to compile the project in

Intellij IDEA
which uses
Scala 2.10
and requires
Java 7
to compile.

I'm using
jenv
tool for compiling from command line (I've installed it's plugin for
Intellij IDEA
as well just in case) and after I use
Java 7
on
jenv
and compile the
Maven
project with this line:

jenv exec mvn clean install


Everything works perfectly.

However when I use
Intellij IDEA
with
Scala
plugin the compilation fails. I have
Java 1.7
setting set everywhere I've found, in
Scala Compiler Server
, in
Java Compiler
, project configuration etc. The failure stacktrace is the following:

Error:scalac: Error: org/jetbrains/jps/incremental/messages/BuildMessage$Kind
java.lang.UnsupportedClassVersionError: org/jetbrains/jps/incremental/messages/BuildMessage$Kind
at org.jetbrains.jps.incremental.scala.local.AbstractCompiler$ClientReporter.log(AbstractCompiler.scala:92)
at xsbt.DelegatingReporter.info0(DelegatingReporter.scala:39)
at scala.tools.nsc.reporters.Reporter$$anonfun$error$1.apply$mcV$sp(Reporter.scala:70)
at scala.tools.nsc.reporters.Reporter$$anonfun$error$1.apply(Reporter.scala:70)
at scala.tools.nsc.reporters.Reporter$$anonfun$error$1.apply(Reporter.scala:70)
at scala.tools.nsc.reporters.Reporter.withoutTruncating(Reporter.scala:42)
at scala.tools.nsc.reporters.Reporter.error(Reporter.scala:70)
at scala.tools.nsc.Global.globalError(Global.scala:228)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1564)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1552)
at scala.tools.nsc.Global$Run.compile(Global.scala:1661)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:115)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:94)
at xsbt.CompilerInterface.run(CompilerInterface.scala:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:32)
at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:68)
at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:25)
at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)


As I understand, this means mismatch between the compiled code java version and the version which tries to run it. I've also seen the Unable to copile scala anymore issue created for
JetBrains
.

So, is there any way I can build this project in
Intellij
? As I'm stuck with this and can't proceed.

Answer Source

The issue seems to be related with Intellij IDEA 2017.1 itself, the bug is already there. I've tried to download version 2016.6.3 and it works well there without any issues.