Skip to content

Instantly share code, notes, and snippets.

@tmarwen
Forked from agentgt/mvn-bom.groovy
Created May 10, 2016 16:55
Show Gist options
  • Save tmarwen/4768937abb6d31ebfd4819808229383b to your computer and use it in GitHub Desktop.
Save tmarwen/4768937abb6d31ebfd4819808229383b to your computer and use it in GitHub Desktop.
#!/usr/bin/env groovy
import groovy.xml.MarkupBuilder
def xml = new XmlSlurper().parse(new File(args[0]));
def sw = new StringWriter()
def b = new MarkupBuilder(sw)
def i = 0;
b.dependencyManagement() {
dependencies() {
for (m in xml.modules.module) {
if (m.text().endsWith('-bom')) continue;
dependency() {
groupId('${project.groupId}');
artifactId(m.text());
version('${project.version}');
}
}
}
}
println sw;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment