manven项目Java Resource红叉报错的处理

来源:互联网 发布:成都php 编辑:程序博客网 时间:2024/06/05 11:33

Eclipse运行maven项目 Java Resource上有个红叉

problems报错为JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer

试了一些方法,最后用这个方法解决

在pom.xml中添加(或修改)

<build>    <plugins>        <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-compiler-plugin</artifactId>            <version>3.0</version>            <configuration>                <source>1.7</source>                <target>1.7</target>            </configuration>        </plugin>    </plugins>  </build>
以上为使用jdk1.7,若使用的1.8用

<build>    <plugins>        <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-compiler-plugin</artifactId>            <version>3.0</version>            <configuration>                <source>1.7</source>                <target>1.7</target>            </configuration>        </plugin>    </plugins>  </build>
原因:jdk版本不一致。

pom.xml中如果没有写此配置,默认是1.5的


0 0