On Tue, 27 Feb 2024 at 17:01, Benjamin Marwell <bmarw...@apache.org> wrote: > > > Compiling for Java 8 with > > Java 17 -release 8 is not the same as compiling with javac from JDK 8. > > They do not produce the same byte code. There is a need to compile > > *with* JDK 8, not just compile *for* JDK 8. > > And when would that be needed?
Isn't that needed for reproducible builds? > > On Tue, 27 Feb 2024, 13:33 Elliotte Rusty Harold, <elh...@ibiblio.org> > wrote: > > > On Mon, Feb 26, 2024 at 7:24 PM Benjamin Marwell <bmarw...@apache.org> > > wrote: > > > > > > > 1. The Java version required by the project being built. That is, the > > > byte code and API level of the project. > > > > 2. The Java version used to compile the project. > > > > 3. The Java version used to run Maven. > > > > 4. The Java version used to compile and build Maven itself. > > > > > > > For #1, it is mandatory to support Java 8. > > > > > > You can compile Java 8 bytecode with a Java 8 JDK from a Maven running > > > Java 17+ using toolchains > > > or with the -release flag from any version 9+. > > > > > > > For #2, reproducible builds mean we have to be able to support what > > > > customers are using and that can be anything from Java 8 - 21. It is > > > > not sufficient to say Java 21 can compile to Java 8 since that does > > > > not produce the same byte code as compiling with Java 8. > > > > > > That is the point. > > > If you built the project with JDK 21 using the -release=8, you can get > > > the same (reproducible) output with a similar OS and JDK 21. > > > > > > > No, that's not the point. You are claiming that #1 and #2 are the > > same. I do not believe they are the same. Compiling for Java 8 with > > Java 17 -release 8 is not the same as compiling with javac from JDK 8. > > They do not produce the same byte code. There is a need to compile > > *with* JDK 8, not just compile *for* JDK 8. > > > > Toolchains support using JDK 8 to compile even though JDK 17 is > > executing Maven, which does handle this. Unfortunately toolchains are > > poorly designed, badly documented, and not widely understood within > > the community. I'm trying to improve some of the docs for toolchains, > > but that only goes so far. There's a fundamental problem that > > toolchains are incompatible with a hermetic, one click build. > > > > -- > > Elliotte Rusty Harold > > elh...@ibiblio.org > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > > For additional commands, e-mail: dev-h...@maven.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org