I have a maven project in eclipse that uses some lambdas, which means I need java 8. I've already set java version in maven to 1.8. However, I have to constantly open the project's properties and set its compliance level to 1.8 because it's constantly being reset to 1.6.
I'm on Eclipse EE Luna 4.4.0, and have tried different things such as disabling per project settings, or going into the project and setting its compliance to 1.8, but both things don't work in the long term.
Usually after setting again the project compliance to 1.8 the package view shows ok, but the editor is still showing errors if I have an opened file that uses lambdas. Then I have to click on the error mark in the editor and choose the suggestion "set project compliance level to 1.8". Sometimes that works, sometimes not.
The problem is triggered specially after launching eclipse, closing and opening the same project, or when I do checkouts. The package view usually is free of errors when I do alt+f5 and update, but the editor view is often still showing errors.
My eclipse maven plugin uses the same maven scripts that I use in the command line, and I never had problems on the command line.
This is driving me crazy, because it happens at least 2x a day and doesn't have a straightforward workaround.
At the end of both my pom and parent pom file I have this:
<project>
. . .
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
The Compiler Compliance level tells Eclipse to use appropriate settings when compiling your project to ensure you code will work on the target JVM you specify. By default, if I recall, Eclipse picks Java 5 Compliance.
To configure compiler compliance level and settings in eclipse, find the below steps. Step 2: Go to Java -> Compiler . Find the print screen. Step 4: To change default compliance settings, we need to uncheck Use default compliance settings and set the compiler java version for .
Add JDK 10 to the workspace and map the EE to it. 2. Create a Java project and add a JDK 10 to its build path 3. Open the Java Compiler setting for the project and find the option "Use compliance from execution environment ..." deselected and disabled.
Do you have a m2e plugin installed?
I had a similar problem before, the plugin always complain about the syntax of parent pom. I finally disabled the plugin and using mvn eclipse:eclipse to create/update the project.
In my case there is no parent pom. I resovled it by :
(1) delete the project from eclipse workspace (do not delete disk content).
(2) search "1.5" from the directory (using notepad++), found 3 occurences in .settings/org.eclipse.jdt.core.prefs, replace them with 1.8 and save.
(3) reopen the project in eclipse.
Note it does not work if you replace them in ecplise editor.
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