Hello Bernd,
I was unaware of the capabilities of the release flag. Thank you for explaining. -- Ceki Gülcü Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch On 2/25/2024 1:37 AM, Bernd Eckenfels wrote: > It has been mentioned before, but just to add, since the bytecode > level is IMHO the smallest problem: > > Jorge Solórzano wrote on 25. Feb 2024 00:41 (GMT +01:00): >> you can use JDK 17 to produce Java 8 bytecode using Java 8 >> features, that is the distinction I made between runtime and build time, >> but it looks it's still not clear. > > In the past a newer JDK version could compile for an older Bytecode version > and > compatible with the source code constructs, BUT it used its own classlibrary > which > had usually different method and therefore create NON-compat results. For that > reason you had to provide the old bootpath if you wanted a clean build (or, > since this > Is nearly the same work than just using the old JDK always use the same > build/target > Version, this was very typical for java7 builds and many think it is needed > for 8 as well). > > But, this is no longer a problem since Java9, the new -release option does > not only simplify > -source and -target into a single option it additionally makes the Java > compiler use an > internal list of approved JCL signatures, therefore being save for cross > compile (only > If you switch to the new flag). > > Unfortunatelly -release 8 has still problems with removed libraries, so it is > a bit of a > work to use newer JDKs to compile old codebase (not a drop-in in some cases > like jaxb). > > Btw Java8 POMs are a bit annoying since you can’t build them on Java 8 > With maven.compiler.release and you can’t (should not) build them on 9+ with > maven.compiler.target. Luckily you can solve that with a profile activated by > runtime version. > https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html > > Gruß > Bernd > — > https://bernd.eckenfels.net > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org