Skip to content

Instantly share code, notes, and snippets.

@friederbluemle
Created July 29, 2014 06:59
Show Gist options
  • Save friederbluemle/25821a42a2eab20562b7 to your computer and use it in GitHub Desktop.
Save friederbluemle/25821a42a2eab20562b7 to your computer and use it in GitHub Desktop.
Manually add dependencies to pom.xml when using maven-publish plugin
publishing {
publications {
maven(MavenPublication) {
// ...
// Manually add dependencies to pom until maven-publish knows how to do it
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment