问题
While trying the freshly released JDK 9, I noticed that it seems to break maven entirely. Even a simple mvn -version
won't work:
vgm@localhost:~$ mvn -version
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
When I switch back to openjdk8, it says the maven version is 3.3.9
.
I've tried setting JAVA_HOME
and MVN_OPTS
, but it had no effect. These are my settings:
vgm@localhost:~$ echo $JAVA_HOME
/usr/java/jdk-9
vgm@localhost:~$ echo $MVN_OPTS
-Dmaven.compiler.fork -Dmaven.compiler.executable=/usr/bin/javac
回答1:
As nullpointer suggested, I updated to Maven 3.5.0, and it works now.
来源:https://stackoverflow.com/questions/46500516/maven-throws-a-classnotfoundexception-codehaus-plexus-launcher-with-jdk-9