Created
July 29, 2014 06:59
-
-
Save friederbluemle/25821a42a2eab20562b7 to your computer and use it in GitHub Desktop.
Manually add dependencies to pom.xml when using maven-publish plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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