|
31 | 31 | import org.gradle.api.publish.maven.MavenPomScm; |
32 | 32 | import org.gradle.api.publish.maven.MavenPublication; |
33 | 33 | 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; |
34 | 39 |
|
35 | 40 | /** |
36 | 41 | * Conventions that are applied in the presence of the {@link MavenPublishPlugin}. When |
|
56 | 61 | */ |
57 | 62 | class MavenPublishingConventions { |
58 | 63 |
|
| 64 | + private static final Logger logger = LoggerFactory.getLogger(MavenPublishingConventions.class); |
| 65 | + |
59 | 66 | void apply(Project project) { |
60 | 67 | project.getPlugins().withType(MavenPublishPlugin.class).all((mavenPublish) -> { |
61 | 68 | PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); |
@@ -93,9 +100,7 @@ private void customizePom(MavenPom pom, Project project) { |
93 | 100 | pom.licenses(this::customizeLicences); |
94 | 101 | pom.developers(this::customizeDevelopers); |
95 | 102 | pom.scm((scm) -> customizeScm(scm, project)); |
96 | | - if (!isUserInherited(project)) { |
97 | | - pom.issueManagement(this::customizeIssueManagement); |
98 | | - } |
| 103 | + pom.issueManagement((issueManagement) -> customizeIssueManagement(issueManagement, project)); |
99 | 104 | } |
100 | 105 |
|
101 | 106 | private void customizeJavaMavenPublication(MavenPublication publication, Project project) { |
@@ -127,16 +132,26 @@ private void customizeDevelopers(MavenPomDeveloperSpec developers) { |
127 | 132 | } |
128 | 133 |
|
129 | 134 | private void customizeScm(MavenPomScm scm, Project project) { |
| 135 | + if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) { |
| 136 | + logger.debug("Skipping Maven POM SCM for non open source build type"); |
| 137 | + return; |
| 138 | + } |
| 139 | + scm.getUrl().set("https://github.com/spring-projects/spring-boot"); |
130 | 140 | if (!isUserInherited(project)) { |
131 | 141 | scm.getConnection().set("scm:git:git://github.com/spring-projects/spring-boot.git"); |
132 | 142 | scm. getDeveloperConnection(). set( "scm:git:ssh://[email protected]/spring-projects/spring-boot.git"); |
133 | 143 | } |
134 | | - scm.getUrl().set("https://github.com/spring-projects/spring-boot"); |
135 | 144 | } |
136 | 145 |
|
137 | | - private void customizeIssueManagement(MavenPomIssueManagement issueManagement) { |
138 | | - issueManagement.getSystem().set("GitHub"); |
139 | | - issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues"); |
| 146 | + private void customizeIssueManagement(MavenPomIssueManagement issueManagement, Project project) { |
| 147 | + if (BuildProperties.get(project).buildType() != BuildType.OPEN_SOURCE) { |
| 148 | + logger.debug("Skipping Maven POM SCM for non open source build type"); |
| 149 | + return; |
| 150 | + } |
| 151 | + if (!isUserInherited(project)) { |
| 152 | + issueManagement.getSystem().set("GitHub"); |
| 153 | + issueManagement.getUrl().set("https://github.com/spring-projects/spring-boot/issues"); |
| 154 | + } |
140 | 155 | } |
141 | 156 |
|
142 | 157 | private boolean isUserInherited(Project project) { |
|
0 commit comments