本文介绍了Maven 为 JDK9 做好准备了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我尝试了 最新的 jdk9 Build 113 并尝试编译 我的项目 使用最新的 Maven 3.3.9

Today I tried the latest jdk9 Build 113 and tried to compile my project with the latest Maven 3.3.9

这些是命令(部分通过twitter找到)

These are the commands (found partially via twitter)

export MVN_OPTS="-Dmaven.compiler.fork -Dmaven.compiler.executable=/somewhere/Downloads/jdk-9/bin/javac"
export JAVA_HOME="/somewhere/Downloads/jdk-9"
mvn clean install

但我得到这个错误 ...简而言之:

But I get this error ... in short:

[WARNING] Error injecting: org.codehaus.plexus.archiver.jar.JarArchiver
java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@9-ea/Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-ea/NativeConstructorAccessorImpl.java:62)

...

at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.<clinit>(AbstractZipArchiver.java:116)
    ... 89 more
[WARNING] Error injecting: org.apache.maven.plugin.jar.JarMojo
java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@9-ea/Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-ea/NativeConstructorAccessorImpl.java:62)

...

at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.<clinit>(AbstractZipArchiver.java:116)
    ... 89 more

JDK9 使用的正确 maven 配置或参数是什么?

$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /home/somewhere/Downloads/maven
Java version: 9-ea, vendor: Oracle Corporation
Java home: /home/somewhere/Downloads/jdk-9
Default locale: en_US, platform encoding: UTF-8
OS name: "linux",...

推荐答案

是的,现在已经准备好了.仍有一些事情正在进行中,但一般可用.以我的一个项目为例.

Yes, it is ready now. Still some things in progress, but generally usable.Check out a project of mine as example.

这篇关于Maven 为 JDK9 做好准备了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 14:18