Commit a6954614 authored by Andy Wilkinson's avatar Andy Wilkinson

Minimize contents of poms that are an ancestor of a user's pom

Fixes gh-21989
parent 0de466e0
...@@ -86,12 +86,16 @@ class MavenPublishingConventions { ...@@ -86,12 +86,16 @@ class MavenPublishingConventions {
pom.getUrl().set("https://spring.io/projects/spring-boot"); pom.getUrl().set("https://spring.io/projects/spring-boot");
pom.getName().set(project.provider(project::getName)); pom.getName().set(project.provider(project::getName));
pom.getDescription().set(project.provider(project::getDescription)); pom.getDescription().set(project.provider(project::getDescription));
if (!isUserInherited(project)) {
pom.organization(this::customizeOrganization); pom.organization(this::customizeOrganization);
}
pom.licenses(this::customizeLicences); pom.licenses(this::customizeLicences);
pom.developers(this::customizeDevelopers); pom.developers(this::customizeDevelopers);
pom.scm(this::customizeScm); pom.scm((scm) -> customizeScm(scm, project));
if (!isUserInherited(project)) {
pom.issueManagement(this::customizeIssueManagement); pom.issueManagement(this::customizeIssueManagement);
} }
}
private void customizeJavaMavenPublication(MavenPublication publication, Project project) { private void customizeJavaMavenPublication(MavenPublication publication, Project project) {
publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy
...@@ -121,9 +125,11 @@ class MavenPublishingConventions { ...@@ -121,9 +125,11 @@ class MavenPublishingConventions {
}); });
} }
private void customizeScm(MavenPomScm scm) { private void customizeScm(MavenPomScm scm, Project project) {
if (!isUserInherited(project)) {
scm.getConnection().set("scm:git:git://github.com/spring-projects/spring-boot.git"); scm.getConnection().set("scm:git:git://github.com/spring-projects/spring-boot.git");
scm.getDeveloperConnection().set("scm:git:ssh://git@github.com/spring-projects/spring-boot.git"); scm.getDeveloperConnection().set("scm:git:ssh://git@github.com/spring-projects/spring-boot.git");
}
scm.getUrl().set("https://github.com/spring-projects/spring-boot"); scm.getUrl().set("https://github.com/spring-projects/spring-boot");
} }
...@@ -132,4 +138,9 @@ class MavenPublishingConventions { ...@@ -132,4 +138,9 @@ class MavenPublishingConventions {
issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues"); issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues");
} }
private boolean isUserInherited(Project project) {
return "spring-boot-starter-parent".equals(project.getName())
|| "spring-boot-dependencies".equals(project.getName());
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment