From a5c35ebcd513aed1007898c60cfd28492fd0d2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Wed, 7 Oct 2026 09:55:58 +0200 Subject: [PATCH 1/2] Adapt maven publish conventions according to spring.build-type Closes gh-52048 --- .../build/MavenPublishingConventions.java | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java index 9e7662c51ef..6f54e1581b6 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java @@ -58,6 +58,7 @@ import org.springframework.boot.build.properties.BuildType; * @author Andy Wilkinson * @author Christoph Dreis * @author Mike Smithson + * @author Stephane Nicoll */ class MavenPublishingConventions { @@ -91,16 +92,18 @@ class MavenPublishingConventions { } private void customizePom(MavenPom pom, Project project) { + BuildType buildType = BuildProperties.get(project).buildType(); + String projectName = project.getName(); pom.getUrl().set("https://spring.io/projects/spring-boot"); pom.getName().set(project.provider(project::getName)); pom.getDescription().set(project.provider(project::getDescription)); - if (!isUserInherited(project)) { + if (!isUserInherited(projectName)) { pom.organization(this::customizeOrganization); } - pom.licenses(this::customizeLicences); + pom.licenses((licenses) -> customizeLicences(licenses, buildType)); pom.developers(this::customizeDevelopers); - pom.scm((scm) -> customizeScm(scm, project)); - pom.issueManagement((issueManagement) -> customizeIssueManagement(issueManagement, project)); + pom.scm((scm) -> customizeScm(scm, buildType, projectName)); + pom.issueManagement((issueManagement) -> customizeIssueManagement(issueManagement, buildType, projectName)); } private void customizeJavaMavenPublication(MavenPublication publication, Project project) { @@ -115,10 +118,15 @@ class MavenPublishingConventions { organization.getUrl().set("https://spring.io"); } - private void customizeLicences(MavenPomLicenseSpec licences) { + private void customizeLicences(MavenPomLicenseSpec licences, BuildType buildType) { licences.license((licence) -> { - licence.getName().set("Apache License, Version 2.0"); - licence.getUrl().set("https://www.apache.org/licenses/LICENSE-2.0"); + if (buildType == BuildType.OPEN_SOURCE) { + licence.getName().set("Apache License, Version 2.0"); + licence.getUrl().set("https://www.apache.org/licenses/LICENSE-2.0"); + } + else { + licence.getName().set("Broadcom Foundation License"); + } }); } @@ -131,32 +139,32 @@ class MavenPublishingConventions { }); } - private void customizeScm(MavenPomScm scm, Project project) { - if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) { + private void customizeScm(MavenPomScm scm, BuildType buildType, String projectName) { + if (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)) { + if (!isUserInherited(projectName)) { 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 customizeIssueManagement(MavenPomIssueManagement issueManagement, Project project) { - if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) { + private void customizeIssueManagement(MavenPomIssueManagement issueManagement, BuildType buildType, + String projectName) { + if (buildType != BuildType.OPEN_SOURCE) { logger.debug("Skipping Maven POM SCM for non open source build type"); return; } - if (!isUserInherited(project)) { + if (!isUserInherited(projectName)) { issueManagement.getSystem().set("GitHub"); 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()); + private boolean isUserInherited(String projectName) { + return "spring-boot-starter-parent".equals(projectName) || "spring-boot-dependencies".equals(projectName); } } From 7217681ed11af3653a19fe69aac6edba6b6e6d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Wed, 7 Oct 2026 10:10:01 +0200 Subject: [PATCH 2/2] Adapt NOTICE according to spring.build-type Closes gh-52052 --- .../org/springframework/boot/build/JavaConventions.java | 6 ++++++ .../org/springframework/boot/build/legal/NOTICE.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java index 899868955ff..cf44bc0528e 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java @@ -71,6 +71,8 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion; import org.springframework.boot.build.architecture.ArchitecturePlugin; import org.springframework.boot.build.classpath.CheckClasspathForProhibitedDependencies; import org.springframework.boot.build.optional.OptionalDependenciesPlugin; +import org.springframework.boot.build.properties.BuildProperties; +import org.springframework.boot.build.properties.BuildType; import org.springframework.boot.build.springframework.CheckAotFactories; import org.springframework.boot.build.springframework.CheckSpringFactories; import org.springframework.boot.build.testing.TestFailuresPlugin; @@ -164,12 +166,16 @@ class JavaConventions { } private void configureJarManifestConventions(Project project) { + BuildType buildType = BuildProperties.get(project).buildType(); + String license = (buildType == BuildType.OPEN_SOURCE) ? "Apache License, Version 2.0" + : "Broadcom Foundation License"; TaskProvider extractLegalResources = project.getTasks() .register("extractLegalResources", ExtractResources.class, (task) -> { task.getPackageName().set("org.springframework.boot.build.legal"); task.getDestinationDirectory().set(project.getLayout().getBuildDirectory().dir("legal")); task.getResourceNames().set(Arrays.asList("LICENSE.txt", "NOTICE.txt")); task.getProperties().put("version", project.getVersion().toString()); + task.getProperties().put("license", license); }); SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class); Set sourceJarTaskNames = sourceSets.stream() diff --git a/buildSrc/src/main/resources/org/springframework/boot/build/legal/NOTICE.txt b/buildSrc/src/main/resources/org/springframework/boot/build/legal/NOTICE.txt index 14f53a2659b..70b02d71088 100644 --- a/buildSrc/src/main/resources/org/springframework/boot/build/legal/NOTICE.txt +++ b/buildSrc/src/main/resources/org/springframework/boot/build/legal/NOTICE.txt @@ -1,6 +1,6 @@ Spring Boot ${version} Copyright (c) 2012-2026 VMware, Inc. -This product is licensed to you under the Apache License, Version 2.0 +This product is licensed to you under the ${license} (the "License"). You may not use this product except in compliance with the License. \ No newline at end of file