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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With