Hi,

Compiling 2.x using JDK 8 requires a lot of tricks:

* Surefire scans classes using the main Maven JDK, so we must be sure
`module-info.class` and other Java 9+ classes are not on the test
classpath. This basically means we need to delete them before testing
and creating them afterwards.
* We need toolchains even if we disable tests,
* Some Maven or compiler plugins (like Error Prone) either require
Java 11 or are hard to configure on Java 8.

That is why I would propose to bump the JDK requirement in the POM
file to JDK 11+ (for `log4j-jpl`) and add `--release 8` everywhere it
makes sense.

For reproducibility purposes the CI and apache-release profiles would
still need to fix a JDK (JDK 17?) for compilation and a JRE (JRE 8)
for testing. But a casual user will be able to run the build process
without toolchains.

I have a working prototype on this branch:

https://github.com/ppkarwasz/logging-log4j2/tree/java17

The only problem I wasn't able to solve is to compile `log4j-jmx-gui`
with JDK 11+: it requires `jconsole.jar` in the classpath, all JDK's
after 8 have a module for that. I think we could move it to a separate
repo.

Remark that `log4j-api`, which uses `sun.reflect.Reflection`, compiles
perfectly with JDK 17 and `--release 8`.

Piotr

Reply via email to