Skip to content

Instantly share code, notes, and snippets.

@is
Created October 15, 2012 16:44
Show Gist options
  • Save is/3893532 to your computer and use it in GitHub Desktop.
Save is/3893532 to your computer and use it in GitHub Desktop.
Gradle read package information from POM file
defaultTasks 'hello'
repositories {
mavenCentral()
}
configurations {
mavenAntTasks
}
dependencies {
mavenAntTasks 'org.apache.maven:maven-ant-tasks:2.1.3'
}
task hello << {
ant.taskdef(
resource: 'org/apache/maven/artifact/ant/antlib.xml',
uri: 'antlib:org.apache.maven.artifact.ant',
classpath: configurations.mavenAntTasks.asPath)
ant.'antlib:org.apache.maven.artifact.ant:pom'(id:'mypom', file:'pom.xml')
println ant.references['mypom'].version
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment