Created
August 2, 2012 14:05
-
-
Save jashatton/3237323 to your computer and use it in GitHub Desktop.
A build.gradle script that reads Maven dependencies using XmlSlurper and applies them to the gradle dependencies.
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
apply plugin: 'java' | |
repositories { | |
mavenCentral() | |
flatDir { | |
dirs 'lib' | |
} | |
} | |
dependencies { | |
def pomXml = new XmlSlurper().parse('pom.xml') | |
def pomDependencies = pomXml.dependencies.dependency | |
pomDependencies.each { dependency -> | |
def dependencySpec = "${dependency.groupId}:${dependency.artifactId}:${dependency.version}" | |
if(dependency.scope == 'test') { | |
dependencies.add 'testCompile', dependencySpec | |
} else { | |
dependencies.add 'compile', dependencySpec | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment