Skip to content

Commit d9eca92

Browse files
generate pom.xml
add gradle task to generate pom.xml include in generated jar file
1 parent a1ac551 commit d9eca92

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
group 'com.cisco.trex'
22

33
apply plugin: 'java'
4+
apply plugin: 'maven'
45

56
sourceCompatibility = 1.8
67
targetCompatibility = 1.8
@@ -31,11 +32,32 @@ dependencies {
3132
}
3233
}
3334

35+
task writePom {
36+
doLast {
37+
pom {
38+
project {
39+
artifactId 'trex-java-sdk'
40+
licenses {
41+
license {
42+
name 'The Apache Software License, Version 2.0'
43+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
44+
}
45+
}
46+
}
47+
}.writeTo("pom.xml")
48+
}
49+
}
50+
3451
jar {
52+
dependsOn writePom
3553
from sourceSets.main.allSource
54+
into("META-INF/maven/$project.group/$project.name") {
55+
from("pom.xml")
56+
}
3657
}
3758

3859
task jarWithDependencies(type: Jar) {
60+
dependsOn writePom
3961
baseName = project.name + '-with-dependencies'
4062
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
4163
with jar

0 commit comments

Comments
 (0)