Remove scope information from published BOM

It seems that publishing a Gradle platform as a Maven POM writes all
dependencies with their scope information by default.

We don't want that when publishing the Spring Framework BOM, as it
forces the scope on projects depending on the BOM, unless they've
specified the scope when they added the dependency to their build.

Typically, developers could get spring-test as a compile dependency
without this change.

This commit removes the scope information from the published BOM.

Fixes gh-23660
This commit is contained in:
Brian Clozel 2019-09-18 15:27:59 +02:00
parent e1e072b75c
commit ab58e29397
1 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,12 @@ publishing {
mavenJava(MavenPublication) {
artifactId = 'spring-framework-bom'
from components.javaPlatform
// remove scope information from published BOM
pom.withXml {
asNode().dependencyManagement.first().dependencies.first().each {
it.remove(it.scope.first())
}
}
}
}
}