6
votes

I've created a web project in STS 2.9.2 using Spring 3.0.6 and Maven 3.0.3. I've created some pages and code with no errors. I've upgraded Spring libraries version from 3.0.6 to 3.1.2 in project's pom.xml and now I get following error message:

Dynamic Web Module 3.0 requires Java 1.6 or newer.

Dynamic web module version and Java compiler version in project's faces are set to 2.5 and 1.6 respectively. Also set JRE system library for my project to 1.6.

I've tried to remove Maven nature and then add it again and JRE system library is set to JSE 1.5 automatically (but I have no Java 1.5 installed). I change JRE system library to 1.6 manually (to fix STS complaint about the JRE system library version) but error about dynamic web module remains.

I've googled for a fix but I've found nothing.

How can I solve that error?

3
I've set back spring version to 3.0.6 in project's pom, I've deleted project from STS and I've imported it into STS as an existing project. Error message has been cleared after that. I don't understand why.Carlos

3 Answers

6
votes

First check that your project is configured probably to use Java 1.7. Right click your project > Properties > Java Compiler and set “Compiler compliance level” to 1.7.

Next from the menu on the left select Project Facets > Java and set its version to 1.7 If you didn’t find 1.7 as one of the drop down options in the previous preferences, then you have to add it to eclipse first. Navigate to eclipse Preferences > Java > Installed JREs, click Add, and locate your installed Java path.

Open your project’s pom.xml and add this plugin tag

<build>
    <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
    </plugins>
</build>

Finally, right click on your project > Maven > Update Project…

Source: http://qussay.com/2013/09/13/solving-dynamic-web-module-3-0-requires-java-1-6-or-newer-in-maven-projects/

3
votes

I couldn't solve this problem by modifying pom.xml, or deleting project and workspace files and restarting eclipse. I fixed it by disabling Maven nature of the project and then re-enabling it.

1
votes

I have the same problem. I delete project from eclipse. In console I type mvn eclipse:clean. After this in Eclipse I imported a maven project and it was a solution.