Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Compiling for different Java versions with Maven

Hi,

This is a follow-up to:

https://www.eclipse.org/lists/cross-project-issues-dev/msg17769.html
https://www.eclipse.org/lists/tycho-user/msg08578.html

So, as Mickael suggested, I updated the pom.xml to use:
<required-maven-version>3.6.3</required-maven-version>
<tycho-version>2.0.0-SNAPSHOT</tycho-version>
and also adding a <configuration> for maven-toolchains-plugin:toolchain.

The Jenkins job is overriding a maven property jdk.version=1.8 or 11. This is used to set <source> and <target> in tycho-compiler-plugin configuration.

When I tried this, it had no effect. The build was compiled for JavaSE-11 even if jdk.version=1.8. However, the build was successful:

https://ci.eclipse.org/tracecompass/job/tracecompass-master-jdk11/17/ (-Djdk.version=1.8)

I found that in order to control the JDK version, I also have to set <release> in tycho-compiler-plugin configuration to 8 or 11. Now the build compiles with the desired JDK, however both builds fail, for different reasons:

https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/167129/4/pom.xml

https://ci.eclipse.org/tracecompass/job/tracecompass-master-jdk11/18/ (-Djdk.version=1.8 -Djdk.release=8)
14:13:14  [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.0.0-SNAPSHOT:compile (default-compile) on project org.eclipse.tracecompass.common.core: Compilation failure: Compilation failure: 
14:13:14  [ERROR] /home/jenkins/agent/workspace/tracecompass-master-jdk11/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/NonNullUtils.java:[91] 
14:13:14  [ERROR] 	return requireNonNull(requireNonNull(stream).<@NonNull T> map(Objects::requireNonNull));
14:13:14  [ERROR] 	                      ^^^^^^^^^^^^^^^^^^^^^^
14:13:14  [ERROR] Potential null pointer access: The method requireNonNull(Stream) may return null
It appears that with the new tycho version and JavaSE-1.8, our external null annotations are no longer working properly. In our project we have configured them so that Objects.requireNonNull(T) returns a @NonNull T.

https://ci.eclipse.org/tracecompass/job/tracecompass-master-jdk11/19/ (-Djdk.version=11 -Djdk.release=11)
14:42:46  [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.0.0-SNAPSHOT:compile (default-compile) on project org.eclipse.tracecompass.tmf.ui: Compilation failure: Compilation failure: 
14:42:46  [ERROR] /home/jenkins/agent/workspace/tracecompass-master-jdk11/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/colors/ColorSettingsXML.java:[23] 
14:42:46  [ERROR] 	import javax.xml.parsers.DocumentBuilder;
14:42:46  [ERROR] 	       ^^^^^^^^^^^^^^^^^
14:42:46  [ERROR] The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml
Something is wrong with the javax.xml modules when using JavaSE-11, but I am not sure how to fix it.

Thank you for any help, I seem to be stuck.
Patrick



Back to the top