I have “fixed” the master branch build.
Most of the components that were generating test jars have been split into two
modules - the main component,
which only builds the jar, and a -test component that builds a -test jar and
then runs the unit tests. But there are
still quirks:
1. log4j-core uses toolchains on MacOS to use Java 17. There is a bug in javac
on Macs that causes compilation
to fail. It is fixed in Java 17 but was not back-ported to Java 11.
2. In general the test jars have a second compilation step to create the
module-info.java. Unfortunately, the unit
tests cannot be modularized because:
a. the unit tests open the main module (i.e. they use the same package
names).
b. the test jar requires the main module.
c. the unit tests require the test module.
This creates a circularity because the unit tests depend on the test module
and it requires the same packages
as the unit tests.
3. I tried building entirely with Java 17 but there were some unit tests in
log4j-core-test that fail. There is one class
that is trying to modify a final variable in the Constant class and it
seems that the technique it is using is no
longer valid.
4. log4j-jul must use Junit 4. It seems Junit 5 is hard-wired to use
java.util.logging and so it isn’t possible to set the
system property in time to have the unit tests use Log4j’s LogManager.
5. JsonTemplateLayout is still creating a test-jar. I haven’t validated if
anything needs it. If it does than it will need to
be split to have a -test module as well.
6. I split the annotation processor into its own module -
log4j-plugin-processor. Note that with modular compiles
annotation processors are no longer added automatically so this should be
clearer.
7. I have not added module-info.java files to anything beyond log4j-api,
log4j-plugins, and log4j-core. That will be
coming next.
8. log4j-api-test has a few tests that seem to randomly fail. I didn’t look
into them.
Please check out master. Hopefully it will look a lot better in your IDE.
Please let me know if you have issues building.
Ralph