10
votes

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?

4
You created a new workspace - did you clear out the old Eclipse .settings and .project ?artbristol
yes, I created a new workspace, and check the project out again. It only contains '.project', no settings folder. if I delete .project then I wont be able to import the project (and it does not have any mention of jax)jeff porter

4 Answers

10
votes

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.

9
votes

It's a bug, fixed in Luna if not SR2. http://bugs.eclipse.org/416704

0
votes

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.

0
votes

I know you can't change your 1.6 JDK, but the following solution might help other people:

In my case, I have both JDK 1.6 and 1.7. I've tried several suggested solutions without any success.

Hence, in my pom.xml I changed from jdk 1.6 to 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).