Maven是否已为JDK9做好准备?

时间:2016-04-12 20:09:52

标签: maven maven-3 java-9

今天我尝试了latest jdk9 Build 113并尝试使用最新的Maven 3.3.9编译my project

这些是命令(部分找到via twitter

<div id="owl" class="owl-carousel owl-theme">
                <div class="item first-item">
                    <div class="products-images">
                        <a href="./img/catalog/9-Assortments-Storage.pdf"     target="_blank">Assortments</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/4-Tools.pdf"               target="_blank">Tools</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/4-Tools.pdf" target="_blank">Cutting Tools</a>
                    </div>
                </div>
                <div class="item active">
                    <div class="products-images ">
                        <a href="./img/catalog/7-Brass.pdf" target="_blank">Fittings</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/6-Electrical.pdf" target="_blank">Electrical</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/1-Fasteners.pdf" target="_blank">Fasteners</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/2014Safety.pdf" target="_blank">Saftey</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/5-ShopSupplies.pdf" target="_blank">Shop Supplies</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/2-Rivets-Huck.pdf" target="_blank">Rivets</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/2014CustomPackaging.pdf" target="_blank">Custom Packaging</a>
                    </div>
                </div>
                <div class="item">
                    <div class="products-images">
                        <a href="./img/catalog/3-Chemicals.pdf" target="_blank">Chemicals</a>
                    </div>
                </div>
            </div>
<script type="text/javascript">
jQuery(document).ready(function(){
  jQuery('#owl').owlCarousel({
    navigation: true,
    nav: true,    
    dots: false,
    dotsEach: false,
    dotData: false,
    center: true,
    autoWidth: true,
    items: 7,
    center:true,
    slideSpeed: 300,
    paginationSpeed: 400,                        
    autoPlay: false,
    responsive:{
        0:{
            items:1
        },
        600:{
            items:3
        },
        1000:{
            items:5
        }
        }
    });
});
</script>

但我得到this error ......总之:

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

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

[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

6 个答案:

答案 0 :(得分:37)

以下是Maven PMC成员(我)的回答:

不,不是。 Robert Scholte正在研究它。拼图和其他东西引入了很多变化。没有正式的时间框架将提供完整的compat(Maven +官方插件)。

你看到的问题实际上不是Maven而是Plexus Archiver。请参阅他们的GitHub页面。如果您认为可以增加价值,请联系maven-dev邮件列表。

进度文档:https://cwiki.apache.org/confluence/display/MAVEN/Java+9+-+Jigsaw

答案 1 :(得分:16)

是的,现在就准备好了。还有一些事情正在进行中,但通常可以使用。 以a project of mine为例。

答案 2 :(得分:11)

更新:现在应该没有此解决方法。

plexus Archiver团队已经解决了这个问题,但尚未发布 - 感谢Michael-O将我指向正确的地方:)!

现在,PR 12中的ctomc发布了一个解决方法,使用旧的plexus Archiver版本2.4.4。:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4.1</version>                    
    <dependencies>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-archiver</artifactId>
            <version>2.4.4</version>
        </dependency>
    </dependencies>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.6</version>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-archiver</artifactId>
            <version>2.4.4</version>
        </dependency>
    </dependencies>
</plugin>

答案 3 :(得分:1)

Java doc插件在上一版本中仍然存在问题。 (3.0.0.M1)

答案 4 :(得分:1)

我认为maven现在已经准备就绪,对我来说,下面的代码片段可以告诉maven使用java 9:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>9</source>
                <target>9</target>
            </configuration>
        </plugin>
    </plugins>
</build>

答案 5 :(得分:0)

我遇到了同样的问题,最近发布的最新maven-javadoc-plugin修复了它。将pom文件中的依赖项更新为<version>3.0.0-M1</version>