From 4bfe2dcb4f15afc62be7106dbb9cf259c489f4a6 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Thu, 4 Sep 2025 08:03:52 +0200 Subject: [PATCH] feat: flatten non-BOM artifacts 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: * ``, ``, and `` are expanded to preserve meaningful metadata and prevent undesirable URL inheritance (i.e., appending `artifactId` to the parent URL). * `` is preserved in each module for clarity and utility. * Keeps the `` element so modules continue to inherit metadata and `dependencyManagement` from `log4j-bom` and their direct ancestors. * `` are removed, but `` and `` 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. --- log4j-mongodb/pom.xml | 7 ------- log4j-parent/pom.xml | 46 +++++++++++++++++++++++++++++++++++++++++++ pom.xml | 46 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 7 deletions(-) diff --git a/log4j-mongodb/pom.xml b/log4j-mongodb/pom.xml index 452ac0a5829..7ccc14fc779 100644 --- a/log4j-mongodb/pom.xml +++ b/log4j-mongodb/pom.xml @@ -128,13 +128,6 @@ true - - - org.junit.jupiter - junit-jupiter-engine - ${junit-jupiter.version} - - diff --git a/log4j-parent/pom.xml b/log4j-parent/pom.xml index 22802a52068..48027a3cdc4 100644 --- a/log4j-parent/pom.xml +++ b/log4j-parent/pom.xml @@ -1140,6 +1140,52 @@ + + + org.codehaus.mojo + flatten-maven-plugin + + + + flatten-revision + + + flatten + + flatten + + process-resources + + + clean + + + keep + + + expand + expand + + + expand + + + interpolate + interpolate + + + + + + + diff --git a/pom.xml b/pom.xml index df51f7d4a0d..80ab7100ad8 100644 --- a/pom.xml +++ b/pom.xml @@ -630,6 +630,37 @@ + + + org.apache.maven.plugins + maven-enforcer-plugin + + + remove-overrides + + enforce + + + initialize + false + + + + parent.version + 12\.1\.1 + Remember to remove overrides from child modules, whenever the changes are moved to `logging-parent`: + * Remove the override `flatten-maven-plugin` configuration from `log4j-parent/pom.xml`. + + + + + + + + + capture-parent-version + + regex-property + + validate + false + + parent.version + ${project.parent.version} + ^(.+)$ + $1 + +