Added maven hacks
This commit is contained in:
parent
4bb08c79ee
commit
d9e7b4b0f7
19
scripts/gradle/maven_hacks.gradle.kts
Normal file
19
scripts/gradle/maven_hacks.gradle.kts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
///////////////////////////////
|
||||||
|
// functions to make changing the maven POM easier
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
fun org.gradle.api.publish.maven.MavenPom.removeDependenciesByArtifactId(vararg names: String) {
|
||||||
|
withXml {
|
||||||
|
(asNode().get("dependencies") as List<groovy.util.Node>).forEach {deps ->
|
||||||
|
(deps.children() as List<groovy.util.Node>).filter { it ->
|
||||||
|
val text = (it.get("artifactId") as List<groovy.util.Node>).firstOrNull()?.text()
|
||||||
|
if (text == null) {
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
names.contains(text)
|
||||||
|
}
|
||||||
|
}.forEach { node->
|
||||||
|
node.parent().remove(node)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user