Skip to content

Commit

Permalink
Minimize contents of poms that are an ancestor of a user's pom
Browse files Browse the repository at this point in the history
Fixes gh-21989
  • Loading branch information
wilkinsona committed Jun 17, 2020
1 parent 0de466e commit a695461
Showing 1 changed file with 17 additions and 6 deletions.
Expand Up @@ -86,11 +86,15 @@ private void customizePom(MavenPom pom, Project project) {
pom.getUrl().set("https://spring.io/projects/spring-boot");
pom.getName().set(project.provider(project::getName));
pom.getDescription().set(project.provider(project::getDescription));
pom.organization(this::customizeOrganization);
if (!isUserInherited(project)) {
pom.organization(this::customizeOrganization);
}
pom.licenses(this::customizeLicences);
pom.developers(this::customizeDevelopers);
pom.scm(this::customizeScm);
pom.issueManagement(this::customizeIssueManagement);
pom.scm((scm) -> customizeScm(scm, project));
if (!isUserInherited(project)) {
pom.issueManagement(this::customizeIssueManagement);
}
}

private void customizeJavaMavenPublication(MavenPublication publication, Project project) {
Expand Down Expand Up @@ -121,9 +125,11 @@ private void customizeDevelopers(MavenPomDeveloperSpec developers) {
});
}

private void customizeScm(MavenPomScm scm) {
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");
private void customizeScm(MavenPomScm scm, Project project) {
if (!isUserInherited(project)) {
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.getUrl().set("https://github.com/spring-projects/spring-boot");
}

Expand All @@ -132,4 +138,9 @@ private void customizeIssueManagement(MavenPomIssueManagement issueManagement) {
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());
}

}

0 comments on commit a695461

Please sign in to comment.