Skip to content

Commit 58968f2

Browse files
committed
Merge branch '3.2.x' into 3.3.x
2 parents c8d3e07 + 89ce26b commit 58968f2

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java

+22-7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
import org.gradle.api.publish.maven.MavenPomScm;
3232
import org.gradle.api.publish.maven.MavenPublication;
3333
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
34+
import org.slf4j.Logger;
35+
import org.slf4j.LoggerFactory;
36+
37+
import org.springframework.boot.build.properties.BuildProperties;
38+
import org.springframework.boot.build.properties.BuildType;
3439

3540
/**
3641
* Conventions that are applied in the presence of the {@link MavenPublishPlugin}. When
@@ -56,6 +61,8 @@
5661
*/
5762
class MavenPublishingConventions {
5863

64+
private static final Logger logger = LoggerFactory.getLogger(MavenPublishingConventions.class);
65+
5966
void apply(Project project) {
6067
project.getPlugins().withType(MavenPublishPlugin.class).all((mavenPublish) -> {
6168
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
@@ -93,9 +100,7 @@ private void customizePom(MavenPom pom, Project project) {
93100
pom.licenses(this::customizeLicences);
94101
pom.developers(this::customizeDevelopers);
95102
pom.scm((scm) -> customizeScm(scm, project));
96-
if (!isUserInherited(project)) {
97-
pom.issueManagement(this::customizeIssueManagement);
98-
}
103+
pom.issueManagement((issueManagement) -> customizeIssueManagement(issueManagement, project));
99104
}
100105

101106
private void customizeJavaMavenPublication(MavenPublication publication, Project project) {
@@ -130,16 +135,26 @@ private void customizeDevelopers(MavenPomDeveloperSpec developers) {
130135
}
131136

132137
private void customizeScm(MavenPomScm scm, Project project) {
138+
if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) {
139+
logger.debug("Skipping Maven POM SCM for non open source build type");
140+
return;
141+
}
142+
scm.getUrl().set("https://github.com/spring-projects/spring-boot");
133143
if (!isUserInherited(project)) {
134144
scm.getConnection().set("scm:git:git://github.com/spring-projects/spring-boot.git");
135145
scm.getDeveloperConnection().set("scm:git:ssh://[email protected]/spring-projects/spring-boot.git");
136146
}
137-
scm.getUrl().set("https://github.com/spring-projects/spring-boot");
138147
}
139148

140-
private void customizeIssueManagement(MavenPomIssueManagement issueManagement) {
141-
issueManagement.getSystem().set("GitHub");
142-
issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues");
149+
private void customizeIssueManagement(MavenPomIssueManagement issueManagement, Project project) {
150+
if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) {
151+
logger.debug("Skipping Maven POM SCM for non open source build type");
152+
return;
153+
}
154+
if (!isUserInherited(project)) {
155+
issueManagement.getSystem().set("GitHub");
156+
issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues");
157+
}
143158
}
144159

145160
private boolean isUserInherited(Project project) {

0 commit comments

Comments
 (0)