Browse Source

uploadArchives customizePom for bom

Previously the bom was not being customized for the uploadArchives task.

This commit enhances the bom plugin to support uploadArchives.

Closes gh-7975
Rob Winch 5 years ago
parent
commit
f892746c00
1 changed files with 25 additions and 15 deletions
  1. 25 15
      buildSrc/src/main/groovy/MavenBomTask.groovy

+ 25 - 15
buildSrc/src/main/groovy/MavenBomTask.groovy

@@ -30,20 +30,30 @@ public class MavenBomTask extends DefaultTask {
 		}
 		project.install {
 			repositories.mavenInstaller {
-				pom.whenConfigured {
-					packaging = "pom"
-					withXml {
-						asNode().children().last() + {
-							delegate.dependencyManagement {
-								delegate.dependencies {
-									projects.sort { dep -> "$dep.group:$dep.name" }.each { p ->
-
-										delegate.dependency {
-											delegate.groupId(p.group)
-											delegate.artifactId(p.name)
-											delegate.version(p.version)
-										}
-									}
+				customizePom(pom)
+			}
+		}
+
+		project.uploadArchives {
+			repositories.mavenDeployer {
+				customizePom(pom)
+			}
+		}
+	}
+
+	public void customizePom(pom) {
+		pom.whenConfigured {
+			packaging = "pom"
+			withXml {
+				asNode().children().last() + {
+					delegate.dependencyManagement {
+						delegate.dependencies {
+							projects.sort { dep -> "$dep.group:$dep.name" }.each { p ->
+
+								delegate.dependency {
+									delegate.groupId(p.group)
+									delegate.artifactId(p.name)
+									delegate.version(p.version)
 								}
 							}
 						}
@@ -52,4 +62,4 @@ public class MavenBomTask extends DefaultTask {
 			}
 		}
 	}
-}
+}