I have a maven project using Java 17. The maven-compiler-pugin is set to <release>17</release>.
If I build this project with a newer JDK version (for example 21), will the produced Jar still be runnable with a JRE 17?
Short answer - yes.
The release property you're using should cover both the produced class version and the usage of API that is available on Java 17.
There's always a caveat that you may be implicitly relying on some undocumented internal behavior and/or bug fix present in Java 21 that won't be present in Java 17, but those should really be rare cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With