Open source projects downloaded on the Web, built with Maven, with an error:
Dynamic Web Module 3.0 requires Java 1.6 or newer.
Jax-rs (REST Web Services) 2.0 requires Java 1.6 or newer.
Even if you set the Properties->java Compiler->complier compliance level to 1.7 or 1.8, it doesn't work.
Workaround:
The first step is to define the version of the JDK in Pom.xml, as follows
<build> <finalName>Example</finalName> <plugins> <plugin> < Groupid>org.apache.maven.plugins</groupid> <artifactid>maven-complier-plugin</artifactid > <version>3.0</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build>
And
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> < Maven.compiler.encoding>utf-8</maven.compiler.encoding> <maven.compiler.source>1.7</ maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> < Maven.compiler.compilerversion>1.7</maven.compiler.compilerversion> </properties>
In the second step, modify the Org.eclipse.jdt.core.prefs file in the. Settings folder to change the version to 1.7
org.eclipse.jdt.core.compiler.codegen.targetplatform=1.7org.eclipse.jdt.core.compiler.compliance =1.7Org.eclipse.jdt.core.compiler.source=1.7
In the third step, modify the Org.eclipse.wst.common.project.facet.core.xml in the. Settings folder to change the Java version to 1.7
<installed facet= "java" version= "1.7"/>
When you are done, refresh the project with MAVEN's update project operation.
[Maven] "Dynamic Web Module 3.0 requires Java 1.6 or newer." or "Jax-rs (REST Web Services) 2.0 requires Java 1.6 or newer."