Skip to content

Instantly share code, notes, and snippets.

@mike-neck
Created June 18, 2019 15:40
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 mike-neck/802c13af63da25b2f2e6f1a2f262fabc to your computer and use it in GitHub Desktop.
Save mike-neck/802c13af63da25b2f2e6f1a2f262fabc to your computer and use it in GitHub Desktop.
maven-publish plugin で bom 出力
plugins {
id 'maven-publish'
}
repositories {
mavenCentral()
}
configurations {
pom
}
dependencies {
pom 'io.netty:netty-all:4.1.36.Final'
pom 'com.google.guava:guava:28.0-jre'
pom 'com.fasterxml.jackson.core:jackson-databind:2.9.9'
}
publishing {
repositories {
mavenLocal()
maven {
name = 'testing'
url = "$buildDir/repo"
}
}
publications {
mavenJava(MavenPublication) {
pom.withXml {
def root = asNode()
def depMan = root.appendNode('dependencyManagement')
def ds = depMan.appendNode('dependencies')
def deps = configurations.pom.allDependencies
deps.each { dep ->
def d = ds.appendNode('dependency')
d.appendNode('groupId').value = dep.group
d.appendNode('artifactId').value = dep.name
d.appendNode('version').value = dep.version
}
}
}
}
}
@mike-neck
Copy link
Author

実行方法

./gradlew publishMavenJavaPublicationToTestingRepository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment