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.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
原因:jdk版本不一致。
pom.xml中如果没有写此配置,默认是1.5的