Why does Eclipse Kepler SR1 error with : JAX-RS 2.0 requires Java 1.7 or newer

jeff porter picture jeff porter · Oct 16, 2013 · Viewed 20.3k times · Source

I have a maven project that give the following two errors

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.

I have JDK 1.6 installed (I cant change this)

The project facets does NOT have JAX-RS ticked.

The project facets has java 1.6 set.

The project facets has Dynamic Web Project 2.4 set.

I have following plugins

Sonar 3.2.0 MercurialEclipse 2.10 EclEmma 2.2.1

The pom.xml is just this...

<?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

<?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.

Note: This is in eclipse-jee-kepler-SR1-win32-x86_64. Note: Version eclipse-jee-kepler-win32-x86_64 does not give the error.

Note: New workspace does not change the error.

Note: I'm using JDK.1.6.0_43

The only error I can see related to this in the ".log" file is..

!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

Adding the facet, wont let me apply it since it says I need Java 1.7

JSR339 (JSR339) states "The API will make extensive use of annotations and will require J2SE 6.0 or later"

Any ideas?

Answer

artbristol picture artbristol · Oct 16, 2013

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.