Skip to content

Instantly share code, notes, and snippets.

@jlafourc
Created July 25, 2012 14:58
Show Gist options
  • Save jlafourc/3176607 to your computer and use it in GitHub Desktop.
Save jlafourc/3176607 to your computer and use it in GitHub Desktop.
Modification du pom généré par gradle
pom.whenConfigured { pom ->
// dep is a native Maven dependency object (With properties artifactId, groupId, ...)
pom.dependencies.each { dep ->
dep.type = 'jar'
println dep
}
}
pom.withXml { provider ->
org.w3c.dom.Document document = provider.asElement().getOwnerDocument()
org.w3c.dom.NodeList nodeList = provider.asElement().getElementsByTagName('dependency')
for (i in0..nodeList.getLength()-1) {
org.w3c.dom.Node childNode = nodeList.item(i)
org.w3c.dom.Node typeNode = document.createElement("type")
typeNode.setTextContent('jar')
childNode.appendChild(typeNode)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment