Skip to content

Instantly share code, notes, and snippets.

@archenroot
Forked from jmruc/README.md
Created August 21, 2017 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archenroot/c2f38207e37fea1ddf503cb33ffc12e5 to your computer and use it in GitHub Desktop.
Save archenroot/c2f38207e37fea1ddf503cb33ffc12e5 to your computer and use it in GitHub Desktop.
Generating pom.xml from gradle

To generate a pom.xml file just run gradle writeNewPom

If you want to generate it as pom.xml in the root of the project, replace writeTo("$buildDir/newpom.xml") with writeTo("pom.xml")

apply plugin: 'maven'
apply plugin: 'java'
sourceCompatibility = 7
targetCompatibility = 7
dependencies {
compile 'com.google.guava:guava:13.0.1'
compile 'joda-time:joda-time:2.1'
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-core:1.9.5'
}
task writeNewPom << {
pom {
project {
groupId 'org.example'
artifactId 'test'
version '1.0.0'
inceptionYear '2008'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}.writeTo("$buildDir/newpom.xml")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment