Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2922

Simplify Java compiler build requirements

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • Build
    • None

    Description

      The current toolchain setup requires either two or three versions of the JDK plus a toolchains.xml Maven configuration. While this setup was sufficient to introduce support for Java 9+ APIs, it has made development slower and more difficult. Some problems include:

      • Any module that depends on a java9 piece breaks incremental compilation; Maven recompiles the entire module every time! This makes it tedious to use mvn test on individual tests.
      • IDEs have difficulty importing and executing toolchain-based Maven projects
      • Contributors have a fairly esoteric hurdle to jump over now to contribute to Log4j
      • As Java continues its release cadence of two releases a year, this makes it harder to test or develop Log4j on newer JDKs. This has become a more obvious problem ever since IDEs like IntelliJ switched from Java 8 to Java 11 as the default JDK.

      To improve this situation, I propose the following build changes to simplify the scenario:

      • Require Java 11 to compile everything.
      • Introduce the animal-sniffer and enforcer Maven plugins to ensure that modules aren't unintentionally using or linking to Java APIs added in versions 9+
      • Fix log4j-jmx-gui to use the jdk.jconsole module instead of linking to tools.jar from the JDK.
      • Find a better multirelease pattern as documented here: https://maven.apache.org/plugins/maven-compiler-plugin/multirelease.html

      This should result in a build that creates Java 8 compatible artifacts but requires Java 11 and only Java 11 to build, therefore significantly simplifying development environment setup for this project.

      Attachments

        Activity

          People

            rgoers Ralph Goers
            mattsicker Matt Sicker
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: