为什么 Eclipse Kepler SR1 错误:JAX-RS 2.0 requires Java 1.7 or newer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19406491/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why does Eclipse Kepler SR1 error with : JAX-RS 2.0 requires Java 1.7 or newer
提问by jeff porter
I have a maven project that give the following two errors
我有一个 maven 项目,它给出了以下两个错误
JAX-RS (REST Web Services) 2.0 can not be installed : One or more constraints have not been satisfied.
JAX-RS (REST Web Services) 2.0 requires Java 1.7 or newer.
无法安装 JAX-RS(REST Web 服务)2.0:一个或多个约束条件尚未满足。
JAX-RS(REST Web 服务)2.0 需要 Java 1.7 或更新版本。
I have JDK 1.6 installed (I cant change this)
我安装了 JDK 1.6(我无法更改)
The project facets does NOT have JAX-RS ticked.
项目方面没有勾选 JAX-RS。
The project facets has java 1.6 set.
项目方面有 java 1.6 集。
The project facets has Dynamic Web Project 2.4 set.
项目方面具有 Dynamic Web Project 2.4 集。
I have following plugins
我有以下插件
Sonar 3.2.0 MercurialEclipse 2.10 EclEmma 2.2.1
声纳 3.2.0 MercurialEclipse 2.10 EclEmma 2.2.1
The pom.xml is just this...
pom.xml 就是这样...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fake.company</groupId>
<artifactId>customerservice-war</artifactId>
<version>2.0.0-SNAPSHOT</version>
</project>
the web.xml is
web.xml 是
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Customer Service</display-name>
</web-app>
Cleaning or "Update Maven Project" makes no difference.
清理或“更新 Maven 项目”没有区别。
Note: This is in eclipse-jee-kepler-SR1-win32-x86_64. Note: Version eclipse-jee-kepler-win32-x86_64 does not give the error.
注意:这是在 eclipse-jee-kepler-SR1-win32-x86_64 中。注意:版本 eclipse-jee-kepler-win32-x86_64 没有给出错误。
Note: New workspace does not change the error.
注意:新工作区不会更改错误。
Note: I'm using JDK.1.6.0_43
注意:我使用的是 JDK.1.6.0_43
The only error I can see related to this in the ".log" file is..
我在“.log”文件中看到的与此相关的唯一错误是..
!ENTRY org.eclipse.osgi 2 1 2013-10-16 15:07:58.816 !MESSAGE NLS unused message: JaxrsProjectConfigurator_The_project_does_not_contain_required_facets in: org.eclipse.m2e.wtp.jaxrs.internal.messages
!ENTRY org.eclipse.osgi 2 1 2013-10-16 15:07:58.816 !MESSAGE NLS 未使用消息:JaxrsProjectConfigurator_The_project_does_not_contain_required_facets 在:org.eclipse.m2e.wtp.jaxrs.internal.message
Adding the facet, wont let me apply it since it says I need Java 1.7
添加方面,不会让我应用它,因为它说我需要 Java 1.7
JSR339 (JSR339) states "The API will make extensive use of annotations and will require J2SE 6.0 or later"
JSR339 ( JSR339) 声明“API 将大量使用注释,并且需要 J2SE 6.0 或更高版本”
Any ideas?
有任何想法吗?
采纳答案by artbristol
Delete the .project
file and banish it from your source control. Instead of using Import -> Existing Project, use Import -> Maven project, and let m2e configure your Eclipse project.
删除该.project
文件并将其从源代码管理中删除。不使用导入 -> 现有项目,而是使用导入 -> Maven 项目,并让 m2e 配置您的 Eclipse 项目。
回答by nitind
It's a bug, fixed in Luna if not SR2. http://bugs.eclipse.org/416704
这是一个错误,如果不是 SR2,则在 Luna 中已修复。http://bugs.eclipse.org/416704
回答by Bipul
If the intention is to just get rid of these errors then you can simply right click on the errors in the "Marker View" and click delete.
如果只是想摆脱这些错误,那么您只需右键单击“标记视图”中的错误,然后单击删除即可。
回答by Thales Diniz
I know you can't change your 1.6 JDK, but the following solution might help other people:
我知道您无法更改 1.6 JDK,但以下解决方案可能对其他人有所帮助:
In my case, I have both JDK 1.6 and 1.7. I've tried several suggested solutions without any success.
就我而言,我同时拥有 JDK 1.6 和 1.7。我已经尝试了几种建议的解决方案,但没有任何成功。
Hence, in my pom.xml I changed from jdk 1.6 to jdk 1.7:
因此,在我的 pom.xml 中,我从 jdk 1.6 更改为 jdk 1.7:
<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>
Using jdk 1.7 worked for me, although in my facets is setted the 1.6 (because my intention was use jdk 1.6).
使用 jdk 1.7 对我有用,尽管在我的方面设置了 1.6(因为我的意图是使用 jdk 1.6)。