Reduce scope of mavenOptional feature to only the Maven Plugin

Previously, the mavenOptional was added to every published module but it
was only used by spring-boot-maven-plugin. This commit reduces its scope
so that it only affects the Maven plugin. It also reworks the
implementation to reuse the existing optional configuration rather than
declaring a new mavenOptional configuration. Lastly, publication of
Gradle Module Metadata (GMM) has been disabled for
spring-boot-maven-plugin. This is seen as preferable to publishing the
metadata – which isn't really needed as it does not contain any useful
additional information – and having to suppress warnings about
incomplete mapping of GMM to pom metadata.

Closes gh-41263
This commit is contained in:
Andy Wilkinson
2024-06-28 09:20:29 +01:00
parent 2ed72c6e4d
commit 365fdfee45
3 changed files with 40 additions and 33 deletions

View File

@@ -58,17 +58,17 @@ dependencies {
intTestImplementation("org.assertj:assertj-core")
intTestImplementation("org.junit.jupiter:junit-jupiter")
mavenOptionalImplementation("org.apache.maven.plugins:maven-shade-plugin") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.enterprise", module: "cdi-api")
exclude(group: "javax.inject", module: "javax.inject")
}
mavenRepository(project(path: ":spring-boot-project:spring-boot", configuration: "mavenRepository"))
mavenRepository(project(path: ":spring-boot-project:spring-boot-test", configuration: "mavenRepository"))
mavenRepository(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "mavenRepository"))
mavenRepository(project(path: ":spring-boot-project:spring-boot-docker-compose", configuration: "mavenRepository"))
optional("org.apache.maven.plugins:maven-shade-plugin") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.enterprise", module: "cdi-api")
exclude(group: "javax.inject", module: "javax.inject")
}
testImplementation("org.apache.maven:maven-core") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.inject", module: "javax.inject")