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的