I am trying to create a maven web app, which will be part of my maven ear application. I tried creating web app from command line as well as from option within eclipse but both ways giving me error like "Dynamic Web Module 3.1 requires Java 1.7 or newer." I tried changing build path JDK to Java 1.8 and compiler level to 1.8 and saved but this didn't resolve the issue. When I do right click on project "maven update", the JDK again getting reset to old one not sure why it's not saving my changes. Is it issue with eclipse(I tried both LUNA and MARS version of eclipse)? How to resolve this issue as it's not letting me run my application from eclipse.
Also I am getting this access restriction warning "Access restriction: The type 'XmlElement' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_25\jre\lib\rt.jar')". If I remove JDK from build path and add it again it disappears. But when maven update is done error reappears. Please someone suggest me how to resolve these issues ?
Add following in pom.xml and do maven update
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Related
i'm new to web service and i'm trying to do a project using jax-rs rest and spring in eclipse.
I use java 1.8 but eclipse shows me an error that jax-rs 2.0 requires java 1.6 or newer error and my project won't work
This is the project explorer and error's screenshot. I tried to google it but can't get any english solutions
Edit : It seems like the screenshot's quality is low if i try to display it so here is the imgur link for the screenshot for better quality
http://i.imgur.com/YYyoeUX.png
Maven projects come with a bunch of plugins applied implicitly to the build. One of them being the maven-compiler-plugin. Unfortunately the Java version for the plugin defaults to 1.5. Most Maven project you see will override the Java version simply by declaring the plugin (in your pom.xml file) and configuring the Java version
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Eclipse (with m2e plugin) will set the compiler compliance level to the setting in the plugin. You can view this by going to
Right click on the project -> properties -> Java Compiler -> Look at compliance level
UPDATE
Instead of the above compiler plugin configuration, you can also simply just do
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
The default plugin configuration will look for these properties. It's a lot less verbose than re-declaring the plugin.
After adding the properties or the compiler plugin to your pom.xml, you might need to update the project. See Manish's answer.
I know the topic is old but I had the same problem and it's hard to find informations on it.
So set the properties wasn't enough for me, I had also to delete the project from Eclipse, then delete the .project file and reimport the project as a Maven project (even if I created it as a Maven project already) like it is answer on this topic.
those who are doing with properties way and if it is not working do this step.
in Pom.xml
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
After that do this:
project folder-> maven--> update project--> check force update-->ok
After that do
project folder-->run as-->mvn build with goal eclipse:eclipse
you don't need to re-import the project as suggested in other answer/
Just got to the path of the project and go to settings and find the xml file named "org.eclipse.wst.common.project.facet.core" and change the version of java from there
ive imported a bunch on maven projects from svn and they all (...a lot) try to use
JRE System Library [JavaSE-1.7]
But i only have
jdk1.8.0_102_64Bit
Which i told eclipse about in eclipse.ini with:
-vm C:\Users\myuser\Downloads\jdk1.8.0_102_64Bit\bin
Yet all the imported maven projects insist to use the "System JRE" which is unbound when i check it.
How do you tell maven to use what eclipse knows about? or where does maven get its information about JDK's / JRE'S?
Maven by default uses JAVA_HOME Environment Variable to know which java version to use. Unless you set different one in pom.xml.
Try check every pom.xml of your projects, they must have a plugin section like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>${JAVA_1_6_HOME}/bin/javac</executable>
</configuration>
</plugin>
Executable tag tell maven to use java 6 in this example.
In this case i probably did something wrong while importing it from svn..a second try worked, but im not sure why :(
I am not able to successfully import the okhttp project in the intellij.
https://github.com/square/okhttp
I am using intellij community edition: 2016.1
Maven: 3.0
When I hit make. It shows following error message for "okhttp-tests" module:
Error:(94, 49) java: diamond operator is not supported in -source 1.5
(use -source 7 or higher to enable diamond operator)
The language level for all the submodules is automatically set to 5, while for parent it is set to 7.
When I change the language level for okhttp-tests module to 7 and hot make, ideas shown me following error message:
Error:java: javacTask: source release 1.7 requires target release 1.7
Am i using wrong version of idea/maven ?
Please help.
Also there is no detailed documentation available for importing project/ setting up dev environment on the git repo.
I would like to request okhttp members to create a descriptive Contributors.md file for beginners like me.
If JAVA_HOME is set correctly, Please also check the Project Parent POM file for the compiler Version of maven-compiler-plugin
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
I am using Java 8 for my JRE in Eclipse Luna with with the m2e Maven plugin. I see this warning as soon as I create a Maven project: Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. I see lots of older advice on this site on how to deal with this error, but nothing related to Java 8. I also that Oracle says J2SE was deprecated in 2008. The most promising answer I have found thus far comes from #Pascal Thivent here:
Warning - Build path specifies execution environment J2SE-1.4
But these instructions no longer seem to be relevant for Luna:
Eclipse project Properties > Maven > Update Project Configuration
I only see "Lifecycle mapping" under Maven.
Can someone please explain (1) what this error means (2) if it is still a worry, given that J2SE-1.5 seems to have been deprecated (3) how to best fix it in Luna?
This error is because the project pom file is instructing maven to compile against java 1.5.
It is best to compile and test to a current java version. In your case java 8.
I am unsure how to fix it inside the eclipse IDE, but the project pom file can be edited to include the compile version as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
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?
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/
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.
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.