Merge branch '3.3.x'

This commit is contained in:
Phillip Webb 2024-09-30 11:37:12 -07:00
commit 5aa08218e3
1 changed files with 22 additions and 7 deletions

View File

@ -31,6 +31,11 @@ import org.gradle.api.publish.maven.MavenPomOrganization;
import org.gradle.api.publish.maven.MavenPomScm;
import org.gradle.api.publish.maven.MavenPublication;
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.build.properties.BuildProperties;
import org.springframework.boot.build.properties.BuildType;
/**
* Conventions that are applied in the presence of the {@link MavenPublishPlugin}. When
@ -56,6 +61,8 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
*/
class MavenPublishingConventions {
private static final Logger logger = LoggerFactory.getLogger(MavenPublishingConventions.class);
void apply(Project project) {
project.getPlugins().withType(MavenPublishPlugin.class).all((mavenPublish) -> {
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
@ -93,9 +100,7 @@ class MavenPublishingConventions {
pom.licenses(this::customizeLicences);
pom.developers(this::customizeDevelopers);
pom.scm((scm) -> customizeScm(scm, project));
if (!isUserInherited(project)) {
pom.issueManagement(this::customizeIssueManagement);
}
pom.issueManagement((issueManagement) -> customizeIssueManagement(issueManagement, project));
}
private void customizeJavaMavenPublication(MavenPublication publication, Project project) {
@ -127,16 +132,26 @@ class MavenPublishingConventions {
}
private void customizeScm(MavenPomScm scm, Project project) {
if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) {
logger.debug("Skipping Maven POM SCM for non open source build type");
return;
}
scm.getUrl().set("https://github.com/spring-projects/spring-boot");
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");
}
private void customizeIssueManagement(MavenPomIssueManagement issueManagement) {
issueManagement.getSystem().set("GitHub");
issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues");
private void customizeIssueManagement(MavenPomIssueManagement issueManagement, Project project) {
if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) {
logger.debug("Skipping Maven POM SCM for non open source build type");
return;
}
if (!isUserInherited(project)) {
issueManagement.getSystem().set("GitHub");
issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues");
}
}
private boolean isUserInherited(Project project) {