1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
apply plugin: 'maven'
task generatePom {
outputs.files "${buildDir}/${project.name}.pom"
assemble.dependsOn generatePom
clean.doLast {
delete "${buildDir}/${project.name}.pom"
}
doFirst {
pom {
project {
name pomName
description pomDesc
}
whenConfigured {
setDependencies(getDependencies().toSorted { a, b ->
if ((a.scope <=> b.scope) != 0) {
a.scope <=> b.scope
} else if ((a.groupId <=> b.groupId) != 0) {
a.groupId <=> b.groupId
} else if ((a.artifactId <=> b.artifactId) != 0) {
a.artifactId <=> b.artifactId
} else {
a.version <=> b.version
}
})
}
}.writeTo("${buildDir}/${project.name}.pom")
}
}
|