Java 9 "object scala in compiler mirror not found"
See original GitHub issueHi,
I am trying to upgrade my project to Java 9 but scala-maven-plugin fails. Same project runs fine on Java 8.
[DEBUG] plugin jar to add :/Users/Nerses/.m2/repository/net/alchim31/maven/scala-maven-plugin/3.3.1/scala-maven-plugin-3.3.1.jar
[DEBUG] cmd: /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/java -Xbootclasspath/a:/Users/Nerses/.m2/repository/org/scala-lang/scala-library/2.12.4/scala-library-2.12.4.jar:/Users/Nerses/.m2/repository/org/scala-lang/scala-compiler/2.12.4/scala-compiler-2.12.4.jar:/Users/Nerses/.m2/repository/org/scala-lang/modules/scala-xml_2.12/1.0.6/scala-xml_2.12-1.0.6.jar:/Users/Nerses/.m2/repository/org/scala-lang/scala-library/2.12.0/scala-library-2.12.0.jar:/Users/Nerses/.m2/repository/org/scala-lang/scala-reflect/2.12.4/scala-reflect-2.12.4.jar -classpath /Users/Nerses/.m2/repository/net/alchim31/maven/scala-maven-plugin/3.3.1/scala-maven-plugin-3.3.1.jar scala_maven_executions.MainWithArgsInFile scala.tools.nsc.Main /private/var/folders/tf/grzpgmz11r32d9dtvclkr1zx9sz3ys/T/scala-maven-15243357590113591240.args
[ERROR] error: error while loading Object, Missing dependency 'object scala in compiler mirror', required by /modules/java.base/java/lang/Object.class
[ERROR] error: scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
[ERROR] at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
[ERROR] at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$4(Mirrors.scala:54)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:54)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:169)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage(Definitions.scala:169)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass$lzycompute(Definitions.scala:170)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass(Definitions.scala:170)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1423)
[ERROR] at scala.tools.nsc.Global$Run.<init>(Global.scala:1164)
[ERROR] at scala.tools.nsc.Driver.doCompile(Driver.scala:34)
[ERROR] at scala.tools.nsc.MainClass.doCompile(Main.scala:24)
[ERROR] at scala.tools.nsc.Driver.process(Driver.scala:55)
[ERROR] at scala.tools.nsc.Driver.main(Driver.scala:68)
[ERROR] at scala.tools.nsc.Main.main(Main.scala)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR] at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
[ERROR] at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
Do you know what is going wrong here? There was a similar issue in sbt and it was fixed in 0.13.17 https://github.com/scala/scala-xml/issues/173
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
scala.reflect.internal.MissingRequirementError: object java ...
The error means that scala was compiled using a version of java, different from the current version. I am ...
Read more >scala.reflect.internal.MissingRequirementError: object java ...
Task :compileTestScala FAILED error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
Read more >object scala in compiler mirror not found
We are trying to run an Interpreter code as part of Apache Livy Interactive Session. The setup is: java version “1.8.0_281” Scala 2.11.8....
Read more >scala.runtime in compiler mirror not found - Google Groups
I've tried including dependencies for scala-reflect and scala-library, Maven options -e and -X, scalac options -g:vars -verbose -explaintypes.
Read more >Resolve Scala compiler failure for Java 9+ in REPL
Failed to initialize compiler : object scala in compiler mirror not found. ** Note that as of 2.8 scala does not assume use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it worked! thank you very much!
@retronym @davidB I was able to reproduce it. https://github.com/NersesAM/scala-maven-java9
The problem seems to be because in that particular module I had code in Java, but tests were written in Scala. In that case
/private/var/folders/tf/grzpgmz11r32d9dtvclkr1zx9sz3ys/T/scala-maven-15243357590113591240.args
file doesn’t contain scala-library in the classpath and build fails.