Skip to content

Commit

Permalink
uploadArchives customizePom for bom
Browse files Browse the repository at this point in the history
Previously the bom was not being customized for the uploadArchives task.

This commit enhances the bom plugin to support uploadArchives.

Closes gh-7975
  • Loading branch information
rwinch committed Mar 30, 2020
1 parent b95ccc2 commit f892746
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions buildSrc/src/main/groovy/MavenBomTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand All @@ -52,4 +62,4 @@ public class MavenBomTask extends DefaultTask {
}
}
}
}
}

0 comments on commit f892746

Please sign in to comment.