From 52618b7031cb6a58b55d2fda6ab7baac2da0e880 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 15 Oct 2024 16:02:38 +0200 Subject: [PATCH 1/6] [MNG-8312] Generate the BOM automatically --- maven-bom/pom.xml | 209 ---------------------------------------------- pom.xml | 33 +++++++- 2 files changed, 31 insertions(+), 211 deletions(-) delete mode 100644 maven-bom/pom.xml diff --git a/maven-bom/pom.xml b/maven-bom/pom.xml deleted file mode 100644 index 164027d419c9..000000000000 --- a/maven-bom/pom.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - 4.0.0 - - org.apache - apache - 33 - - - - org.apache.maven - maven-bom - 4.0.0-beta-5-SNAPSHOT - pom - - Maven Dependencies BOM - Bill Of Materials for Apache Maven dependencies - https://maven.apache.org/ref/${project.version}/${project.artifactId} - - - scm:git:https://gitbox.apache.org/repos/asf/maven.git - scm:git:https://gitbox.apache.org/repos/asf/maven.git - maven-4.0.0-beta-3 - https://github.com/apache/maven/tree/${project.scm.tag}/${project.artifactId} - - - jira - https://issues.apache.org/jira/browse/MNG - - - Jenkins - https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven/ - - - - apache.website - scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path} - - https://maven.apache.org/download.html - - - - ref/4-LATEST/${project.artifactId} - - - - - - - org.apache.maven - maven-artifact - ${project.version} - - - org.apache.maven - maven-builder-support - ${project.version} - - - org.apache.maven - maven-core - ${project.version} - - - org.apache.maven - maven-embedder - ${project.version} - - - org.apache.maven - maven-model - ${project.version} - - - org.apache.maven - maven-api-core - ${project.version} - - - org.apache.maven - maven-api-meta - ${project.version} - - - org.apache.maven - maven-api-model - ${project.version} - - - org.apache.maven - maven-api-settings - ${project.version} - - - org.apache.maven - maven-api-spi - ${project.version} - - - org.apache.maven - maven-api-toolchain - ${project.version} - - - org.apache.maven - maven-api-plugin - ${project.version} - - - org.apache.maven - maven-api-xml - ${project.version} - - - org.apache.maven - maven-model-builder - ${project.version} - - - org.apache.maven - maven-plugin-api - ${project.version} - - - org.apache.maven - maven-repository-metadata - ${project.version} - - - org.apache.maven - maven-resolver-provider - ${project.version} - - - org.apache.maven - maven-settings - ${project.version} - - - org.apache.maven - maven-settings-builder - ${project.version} - - - org.apache.maven - maven-toolchain-model - ${project.version} - - - org.apache.maven - maven-toolchain-builder - ${project.version} - - - org.apache.maven - maven-logging - ${project.version} - - - org.apache.maven - maven-xml-impl - ${project.version} - - - - - - - - maven-site-plugin - - ${project.distributionManagement.site.url}/.. - - - - org.apache.rat - apache-rat-plugin - - - rat-check - none - - - - - - diff --git a/pom.xml b/pom.xml index 7ca7b86abf65..c0867bc19d90 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ under the License. org.apache.maven maven-parent - + 43 @@ -122,7 +122,6 @@ under the License. apache-maven maven-toolchain-model maven-toolchain-builder - maven-bom maven-docgen @@ -163,6 +162,7 @@ under the License. ref/4-LATEST 2024-08-30T12:59:00Z + 33 3.26.3 9.7.1 1.15.4 @@ -668,6 +668,12 @@ under the License. byte-buddy ${byteBuddyVersion} + + org.apache + apache + ${apacheVersion} + pom + @@ -856,6 +862,29 @@ under the License. + + eu.maveniverse.maven.plugins + bom-builder3 + 1.0.0 + + + skinny-bom + + build-bom + + + org.apache.maven + maven-bom + ${project.version} + Maven Dependencies BOM + Bill Of Materials for Apache Maven dependencies + org.apache:apache:${apacheVersion} + maven-bom.xml + true + + + + From c1721f9e93d0f7a57d106b85f0fc8e6ace0c3d9c Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Wed, 16 Oct 2024 22:51:00 +0200 Subject: [PATCH 2/6] Remove BOM parent --- pom.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pom.xml b/pom.xml index c0867bc19d90..ae4a83169040 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,6 @@ under the License. org.apache.maven maven-parent - 43 @@ -162,7 +161,6 @@ under the License. ref/4-LATEST 2024-08-30T12:59:00Z - 33 3.26.3 9.7.1 1.15.4 @@ -668,12 +666,6 @@ under the License. byte-buddy ${byteBuddyVersion} - - org.apache - apache - ${apacheVersion} - pom - @@ -878,7 +870,6 @@ under the License. ${project.version} Maven Dependencies BOM Bill Of Materials for Apache Maven dependencies - org.apache:apache:${apacheVersion} maven-bom.xml true From 2dc7f85e101025ea12b913f9df0052f4a4aca764 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 17 Oct 2024 10:47:21 +0200 Subject: [PATCH 3/6] Generate both skinny and fat BOMs --- apache-maven/pom.xml | 40 ++++++++++++++++++++++++++++++++++++++++ pom.xml | 22 ---------------------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 857e2d88cc14..54cc9164c779 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -220,6 +220,46 @@ under the License. + + eu.maveniverse.maven.plugins + bom-builder3 + 1.0.0 + + + skinny-bom + + build-bom + + + org.apache.maven + maven-bom + ${project.version} + Maven Dependencies BOM + skinny + Bill Of Materials for Apache Maven - Maven JARS only + maven-skinny-bom.xml + true + + + + fat-bom + + build-bom + + + org.apache.maven + maven-bom + ${project.version} + Maven Dependencies BOM + fat + Bill Of Materials for Apache Maven - All dependencies + maven-fat-bom.xml + true + true + + + + diff --git a/pom.xml b/pom.xml index ae4a83169040..2642063ab94f 100644 --- a/pom.xml +++ b/pom.xml @@ -854,28 +854,6 @@ under the License. - - eu.maveniverse.maven.plugins - bom-builder3 - 1.0.0 - - - skinny-bom - - build-bom - - - org.apache.maven - maven-bom - ${project.version} - Maven Dependencies BOM - Bill Of Materials for Apache Maven dependencies - maven-bom.xml - true - - - - From b4fc469f194387da4fe43b3a9130b250f3217de8 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 17 Oct 2024 15:32:18 +0200 Subject: [PATCH 4/6] Fix deployment --- apache-maven/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 54cc9164c779..5a7d92e9ba37 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -223,7 +223,7 @@ under the License. eu.maveniverse.maven.plugins bom-builder3 - 1.0.0 + 1.0.1 skinny-bom @@ -234,8 +234,8 @@ under the License. org.apache.maven maven-bom ${project.version} - Maven Dependencies BOM skinny + Maven Dependencies Skinny BOM Bill Of Materials for Apache Maven - Maven JARS only maven-skinny-bom.xml true @@ -250,7 +250,7 @@ under the License. org.apache.maven maven-bom ${project.version} - Maven Dependencies BOM + Maven Dependencies Fat BOM fat Bill Of Materials for Apache Maven - All dependencies maven-fat-bom.xml From 48e83ea42e2c99164d0b5f67c16af463cf34829a Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Thu, 17 Oct 2024 16:15:01 +0200 Subject: [PATCH 5/6] Import w/ classifier Only from Model 4.1.0+ --- .../impl/model/DefaultModelValidator.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelValidator.java b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelValidator.java index 8867a8257357..56f3fde5f3f4 100644 --- a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelValidator.java +++ b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelValidator.java @@ -471,7 +471,13 @@ public void validateFileModel( } validate20RawDependencies( - problems, m.getDependencies(), "dependencies.dependency.", EMPTY, validationLevel, request); + problems, + m.getDependencies(), + "dependencies.dependency.", + EMPTY, + isModelVersion41OrMore, + validationLevel, + request); validate20RawDependenciesSelfReferencing( problems, m, m.getDependencies(), "dependencies.dependency", request); @@ -482,6 +488,7 @@ public void validateFileModel( m.getDependencyManagement().getDependencies(), "dependencyManagement.dependencies.dependency.", EMPTY, + isModelVersion41OrMore, validationLevel, request); } @@ -539,6 +546,7 @@ public void validateFileModel( profile.getDependencies(), prefix, "dependencies.dependency.", + isModelVersion41OrMore, validationLevel, request); @@ -548,6 +556,7 @@ public void validateFileModel( profile.getDependencyManagement().getDependencies(), prefix, "dependencyManagement.dependencies.dependency.", + isModelVersion41OrMore, validationLevel, request); } @@ -982,6 +991,7 @@ private void validate20RawDependencies( List dependencies, String prefix, String prefix2, + boolean is41OrBeyond, int validationLevel, ModelBuilderRequest request) { Severity errOn30 = getSeverity(validationLevel, ModelValidator.VALIDATION_LEVEL_MAVEN_3_0); @@ -1002,7 +1012,8 @@ private void validate20RawDependencies( key, "must be 'pom' to import the managed dependencies.", dependency); - } else if (dependency.getClassifier() != null + } else if (!is41OrBeyond + && dependency.getClassifier() != null && !dependency.getClassifier().isEmpty()) { addViolation( problems, From 1f099f0f790bd0886e32ba8f9d77fd75abc709e1 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 17 Oct 2024 16:46:33 +0200 Subject: [PATCH 6/6] Keep same order for elements --- apache-maven/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 5a7d92e9ba37..d46aa209cd43 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -250,8 +250,8 @@ under the License. org.apache.maven maven-bom ${project.version} - Maven Dependencies Fat BOM fat + Maven Dependencies Fat BOM Bill Of Materials for Apache Maven - All dependencies maven-fat-bom.xml true