• [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."


    在网上下载的开源工程,用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操作,刷新整个工程。

  • 相关阅读:
    poj 2109Power of Cryptography
    poj 2632Crashing Robots
    poj 2586Y2K Accounting Bug
    linux0.12中文件系统的一些理解
    latex初学者的经验
    关于linux0.12中的add_entry中bread中的些猜测
    uid gid euid egid详解
    关于linux0.12文件系统目录大小的一个发现
    我的初级muttrc配置
    使用STM32的USB模块中后对USB缓冲区的认识
  • 原文地址:https://www.cnblogs.com/cner/p/7499082.html
Copyright © 2020-2023  润新知