首页 > 编程语言 > 详细

[maven] "Dynamic Web Module 3.0 requires Java 1.6 or newer." OR "JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer."

时间:2017-09-09 20:07:42      阅读:1114      评论:0      收藏:0      [点我收藏+]

在网上下载的开源工程,用maven构建的时候报错:

Dynamic Web Module 3.0 requires Java 1.6 or newer.

JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer.

即使你把properties->Java Compiler->Complier compliance level设置为1.7或1.8也不管用。

解决方法:

第一步,在pom.xml中定义jdk的版本,如下

     <build>
        <finalName>Example</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-complier-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

以及

<properties>        
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>    
    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>    
</properties>

  

第二步,修改.settings文件夹里的org.eclipse.jdt.core.prefs文件,把其中的版本均改为1.7

org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.source=1.7

 

第三步,修改.settings文件夹里的org.eclipse.wst.common.project.facet.core.xml,把其中java的版本改为1.7

 

<installed facet="java" version="1.7"/>

 

完成之后,再通过maven的update project操作,刷新整个工程。

[maven] "Dynamic Web Module 3.0 requires Java 1.6 or newer." OR "JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer."

原文:http://www.cnblogs.com/cner/p/7499082.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!