Created
June 18, 2019 15:40
-
-
Save mike-neck/802c13af63da25b2f2e6f1a2f262fabc to your computer and use it in GitHub Desktop.
maven-publish plugin で bom 出力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} | |
} | |
} | |
} | |
実行方法
./gradlew publishMavenJavaPublicationToTestingRepository
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
出力結果