logging-log4j2 icon indicating copy to clipboard operation
logging-log4j2 copied to clipboard

feat: flatten non-BOM artifacts

Open ppkarwasz opened this issue 4 months ago • 0 comments

This change introduces a new execution of the Flatten Maven Plugin for non-BOM modules, aimed at simplifying their published POMs while preserving important metadata and build integrity.

Key changes

  • Applies clean mode, removing most optional POM elements.

  • Retains key elements:

    • <name>, <description>, and <url> are expanded to preserve meaningful metadata and prevent undesirable URL inheritance (i.e., appending artifactId to the parent URL).
    • <license> is preserved in each module for clarity and utility.
  • Keeps the <parent> element so modules continue to inherit metadata and dependencyManagement from log4j-bom and their direct ancestors.

  • <properties> are removed, but <dependencies> and <dependencyManagement> are retained with interpolated values to avoid unresolved variables in the flattened POMs.

Differences from the clean mode

  • Keeps name and description per module to aid discoverability.
  • Delegates all contact and project metadata (organization, developers, mailing lists, SCM, issue tracker, CI config, etc.) to the centralized log4j-bom POM.
  • Preserves dependencyManagement sections by interpolating versions, rather than removing them.
  • Retains non-transitive scopes (provided, test) to expose compile/test-time dependencies, even if consumers don't require them.

This flattening strategy reduces noise in published POMs while maintaining enough structure for clarity and downstream tool compatibility.

Another advantage of this approach is that the Flatten Maven Plugin computes the effective POM using the already flattened parent POMs, unlike Maven’s reactor, which uses the source POM files. This helps catch issues early and prevents unresolved properties from being accidentally propagated into the published POMs.

While this change will likely belong in logging-parent eventually, this PR is currently targeted here (and marked as a draft) for two main reasons:

  • To allow for experimentation and validation before moving it upstream to logging-parent.
  • To make it available in 2.25.2 without incurring the additional overhead of releasing a new version of logging-parent.

ppkarwasz avatar Sep 04 '25 09:09 ppkarwasz