scala-maven-plugin java 9 support

259 views
Skip to first unread message

John Poth

unread,
Feb 16, 2017, 4:38:21 PM2/16/17
to Maven and Scala
Hi all,

I'm trying out the scala-maven-plugin 3.2.2 with java 9 build 156 and was wondering what the status is on supporting Java 9 ? Right now when I run the plugin I get the error:

[ERROR] error: scala.reflect.internal.MissingRequirementError: object java.lang.Object 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)

Which I am pretty sure it can be solved by passing the option "-J--add-opens -Jjava.base/java.lang=ALL-UNNAMED" to the javac compiler (works with the maven compiler plugin). However I'm not sure how to do that or if it makes sense in this case. After looking around, I tried to pass those arguments with the following configuration:

<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
    <version>3.2.2</version>
<configuration>
<!--<fork>true</fork>-->
<javacArgs>-J--add-opens -Jjava.base/java.lang=ALL-UNNAMED -J--add-opens -Jjava.base/java.lang.reflect=ALL-UNNAMED</javacArgs>
<args>-J--add-opens -Jjava.base/java.lang=ALL-UNNAMED -J--add-opens -Jjava.base/java.lang.reflect=ALL-UNNAMED</args>
</configuration>
</plugin>

But still no luck. Is there a way to make this work or is this not supported yet?

Cheers,

John.

Adam Pocock

unread,
Sep 22, 2017, 3:17:18 AM9/22/17
to Maven and Scala
Hi John,

As this has a fairly high hit on Google for scala-maven-plugin & Java 9, I thought I'd add that it does compile if you use Scala 2.12, and the latest version of the scala-maven-plugin, which is 3.3.1.

I lost an hour to figuring this out after upgrading to the release version of Java 9.

Thanks,

Adam
Reply all
Reply to author
Forward
0 new messages