Hi,

you should look up the `--release` flag available since Java 9 (which is
what the Jenkins project uses).

Cheers,

Vincent


Le mer. 17 juil. 2024 à 14:51, Markus Hoffrogge <mhoffro...@gmail.com> a
écrit :

> Hi all,
>
> just have joined this group by today - so maybe my question might have
> been discussed already but within a few minutes I could not find much on
> this - so would like to check on this topic within this group.
>
> As far as I see the Jenkins CI infrastructure plugins build jobs are
> running for different Java JDK versions - currently for Java 17 and Java 21
> as far as I could see.
>
> On the other hand side the current POM is defining java level 11, BUT it
> is not making use of the Maven toolchain plugin.
>
> IMHO this is not best practice, since the classes will be compiled to
> comply with the Java level defined by the POM, BUT the ompile reference to
> java runtime/bootstrap API is to the Java level of the JDK version running
> the Maven build job.
>
> This implies the risk that code could make use of higher level Java APIs
> and would compile well, but if this code is running on a lower level java
> runtime matching the classes level signature it will fail, since that API
> does not exist in the lower level runtime.
>
> For that reason Maven is providing the toolchain plugin.
> The toolchain plugin enables to compile with the toolchain specified JDK
> version - which can differ from the Maven job runtime JDK.
> Same for JUnit testing via surefire plugin.
>
> Is there a reason why Jenkins POM definitions are not making use of it?
>
> Kind regards
> Markus
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/1569c8d2-8d74-4a5a-b4d8-4dbd49c39b9cn%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/1569c8d2-8d74-4a5a-b4d8-4dbd49c39b9cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAH-zGCj9m2KD9aHxehMd%2Bhop261cCGc%2B62syjqbky3LeLe4CjQ%40mail.gmail.com.

Reply via email to