Skip to main content

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

Hi Mickael,

This is all new and confusing to me so I'm learning as I go along. I'll describe what I observe, not knowing what is relevant...

What do you mean by "the build was compiled for JavaSE-11 ? Aren't the class files not using the Java 1.8 class version?

This was on the Jenkins build running a Docker image. I do not know how to tell if the class files are compiled for 1.8 or 11 from the tycho-compiler-plugin on the remote machine.

I had based myself on the fact that the log showed the test running with java.version=11.0.2 and the exception stack traces show "at java.base/java.lang.*" instead of "at java.lang.*". But I guess the test can run with JavaSE-11 even if classes are compiled for JavaSE-1.8, right?

I tried it locally from the command-line mvn and using 'javap -verbose' I can see that the class files are indeed version 52 (JavaSE-1.8).

However, a better and more portable approach (with PDE) is to override the source/target levels in build.properties.

I'm not sure what that means. Is it each plug-in's build.properties file (we have 125 plug-ins)? What property would we need to set and how would we dynamically set it from the Jenkins/mvn parameters?

I guess other issues are consequence of the workarounds you've found, so let's focus our attention on this root cause at the moment.

So, I was able to reproduce this locally from the command-line mvn.

-Djdk.version is used to set: ("1.8" or "11")
tycho-compiler-plugin <source>
tycho-compiler-plugin <target>
maven-toolchains-plugin <toolchains><jdk><version>
tycho-eclipserun-plugin <executionEnvironment> (as JavaSE-${jdk.version})

-Djdk.release is used to set: ("8" or "11")
tycho-compiler-plugin <release>

Note that tycho-surefire-plugin <useJDK> is not set in our pom.xml.

This is what I observe:

> mvn clean install -Djdk.version=1.8 (tycho-compiler-plugin <release> not set in pom.xml)
class version=52
all tests run with java.version=11.0.2 successfully

> mvn clean install -Djdk.version=1.8 -Djdk.release=8 (tycho-compiler-plugin <release> set in pom.xml)
class version=52
core compilation failure due to not working external null annotations "Potential null pointer access"

> mvn clean install -Djdk.version=11 (tycho-compiler-plugin <release> not set in pom.xml)
class version=55
core tests run with java.version=11.0.2 successfully
ui plugin compilation failure "The package * is accessible from more than one module: <unnamed>, java.xml"

> mvn clean install -Djdk.version=11 -Djdk.release=11 (tycho-compiler-plugin <release> set in pom.xml)
class version=55
core tests run with java.version=11.0.2 successfully
ui plugin compilation failure "The package * is accessible from more than one module: <unnamed>, java.xml"

Patrick

On Tue, Aug 4, 2020 at 4:45 PM Mickael Istria <mistria@xxxxxxxxxx> wrote:


On Tue, Aug 4, 2020 at 10:19 PM Patrick Tasse <patrick.tasse@xxxxxxxxx> wrote:
When I tried this, it had no effect. The build was compiled for JavaSE-11 even if jdk.version=1.8.

What do you mean by "the build was compiled for JavaSE-11 ? Aren't the class files not using the Java 1.8 class version?
If not, it's an important bug so please report it. However, a better and more portable approach (with PDE) is to override the source/target levels in build.properties.

I guess other issues are consequence of the workarounds you've found, so let's focus our attention on this root cause at the moment.
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/tycho-user

Back to the top