Reputation: 646
I am using maven and tycho plug-in to build an eclipse RCP application. I use some java 8 features like lambda expression, but it could not build correctly because of compilation failure.
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (default-compile) on project ***.***: Compilation failure: Compilation failure:
[ERROR] .filter(Objects::nonNull)
[ERROR] ^^^^^^^^^^^^^^^^
[ERROR] Method references are allowed only at source level 1.8 or above
[ERROR] 2 problems (2 errors)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
My questions are:
Upvotes: 3
Views: 2429
Reputation: 1061
I had the same problem and the solution was to set JAVA_HOME to the right JDK.
Upvotes: 0
Reputation: 646
As mentioned in the tycho-compiler-plugin documentation, the information in file .settings/org.eclipse.jdt.core.prefs will be passed to the compiler.
It is necessary then to update the file as follow:
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.source=1.8
Upvotes: 6
Reputation: 1984
You have to specify the source level in your pom.xml
file:
<project>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
This has nothing to do with tycho, it is the compiler plugin.
You can alternatively configure the plugin itself.
Please refer to this page.
Upvotes: 0