Confusing warning or wrong use of system JDK in the compiler plugin? #3732
Replies: 4 comments 3 replies
-
@LorenzoBettini in short, don't use The longer story is For you use-case, simply make either only Java 21 available and Tycho will pass the appropriate target level to the compiler and everything works fine. And even the warning should be gone with Tycho 4.0.7 now because its not really useful. If compilation fails, it is most likely because your bundle is still at BREE 11 where it would require BREE 21 to use Java 21 APIs. |
Beta Was this translation helpful? Give feedback.
-
@laeubi I confirm that the compilation failure was due to another issue. However, does the warning
means that JDK 17 will be effectively used instead of JDK 21? As I said, in GitHub Action you can set a JDK to be the default, but, in any case, JDK 8, 11 and 17 are still available in the system (and cannot be uninstalled as far as I know). So, does the warning above say that JDK 17 will be used since it can be found in the system? For the moment, I make sure to use JDK 21 with the maven toolchain plugin. |
Beta Was this translation helpful? Give feedback.
-
And in the Tycho 4 branch the log and check seem to be still there: |
Beta Was this translation helpful? Give feedback.
-
Hello @laeubi,
Since I get the following warning message when using tycho 4.0.8 in combination with
|
Beta Was this translation helpful? Give feedback.
-
Maybe I don't get how the use of JDK by the compiler plugin should work (I'm using Tycho 4.0.6), but, https://tycho.eclipseprojects.io/doc/latest/tycho-compiler-plugin/compile-mojo.html#useJDK says
In GitHub Actions I setup Java 21 as the JDK, which is also reported by Maven correctly:
So I'd assume Tycho will use this one, since I haven't configured
useJDK
.However, during the build I see:
This comes from this code
tycho/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentUtils.java
Line 89 in be568d8
which, I seem to understand, searches for JDKs and stops as soon as it finds one higher than the profile of the currently compiled bundle. Since also Java 17 is installed in GitHub Actions (though it's not the set as the default, see above), Tycho is going to use Java 17 instead of Java 21?
By the documentation above I'd assume it should use the JDK set in the system (Java 21).
Or is just a misguided warning message?
Due to some compilation failures later in the build, it looks like it's really using Java 17 instead of Java 21 (the compilation fails because it cannot find the ArrayList.getLast method, introduced in Java 21).
Should I set a toolchain explicitly?
By the way, in our project, Xtext, we still use Java 11 as the required Java, but we'd like to test with Java 21.
thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions