@@ -2,6 +2,7 @@ plugins {
22 id ' com.github.kt3k.coveralls' version ' 2.12.2'
33 id ' com.google.osdetector' version ' 1.7.3'
44 id ' jvm-test-suite'
5+ id ' com.vanniktech.maven.publish' version ' 0.35.0'
56}
67
78allprojects {
@@ -28,14 +29,14 @@ subprojects {
2829 }
2930
3031 apply plugin : ' java-library'
31- apply plugin : ' maven-publish'
32- apply plugin : ' signing'
32+
33+ // vanniktech plugin (maven-publish + signing)
34+ apply plugin : ' com.vanniktech.maven.publish'
3335
3436 java {
3537 sourceCompatibility = JavaVersion . VERSION_1_8
3638 targetCompatibility = JavaVersion . VERSION_1_8
3739
38- withJavadocJar()
3940 withSourcesJar()
4041 }
4142
@@ -44,65 +45,52 @@ subprojects {
4445 exclude " **/internal/**"
4546 }
4647
47- publishing {
48- repositories {
49- maven {
50- credentials {
51- username = project. properties[" mavenDeployUser" ] ?: System . getenv(" NEXUS_USERNAME" )
52- password = project. properties[" mavenDeployPassword" ] ?: System . getenv(" NEXUS_TOKEN" )
48+ // Central Portal + signing configuration
49+ mavenPublishing {
50+ // Credentials come from:
51+ // - ORG_GRADLE_PROJECT_mavenCentralUsername
52+ // - ORG_GRADLE_PROJECT_mavenCentralPassword
53+ publishToMavenCentral()
54+ signAllPublications()
55+
56+ pom {
57+ name. set(project. name)
58+ url. set(' https://github.com/spiffe/java-spiffe' )
59+
60+ // description is only available after evaluation
61+ afterEvaluate {
62+ if (project. description != null ) {
63+ description. set(project. description)
5364 }
54- url = project. properties[" mavenDeployUrl" ]
5565 }
56- }
5766
58- publications {
59- mavenJava(MavenPublication ) {
60- groupId project. group
61- version " ${ project.version} "
62- from components. java
63-
64- pom {
65- name = project. name
66- artifactId = project. name
67- url = ' https://github.com/spiffe/java-spiffe'
68- afterEvaluate {
69- // description is not available until evaluated.
70- description = project. description
71- }
67+ scm {
68+ connection = ' scm:git:https://github.com/spiffe/java-spiffe.git'
69+ developerConnection = ' scm:git:git@github.com:spiffe/java-spiffe.git'
70+ url = ' https://github.com/spiffe/java-spiffe'
71+ }
7272
73- scm {
74- connection = ' scm:git:https://github.com/spiffe/java-spiffe.git'
75- developerConnection = ' scm:git:git@github.com:spiffe/java-spiffe.git'
76- url = ' https://github.com/spiffe/java-spiffe'
77- }
73+ licenses {
74+ license {
75+ name = ' The Apache License, Version 2.0'
76+ url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
77+ }
78+ }
7879
79- licenses {
80- license {
81- name = ' The Apache License, Version 2.0'
82- url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
83- }
84- }
85- developers {
86- [' maxlambrecht:Max Lambrecht' , ' rturner3:Ryan Turner' ]. each { devData ->
87- developer {
88- def devInfo = devData. split(' :' )
89- id = devInfo[0 ]
90- name = devInfo[1 ]
91- url = ' https://github.com/' + devInfo[0 ]
92- roles = [" Maintainer" ]
93- }
94- }
80+ developers {
81+ [' maxlambrecht:Max Lambrecht' , ' rturner3:Ryan Turner' ]. each { devData ->
82+ developer {
83+ def devInfo = devData. split(' :' )
84+ id = devInfo[0 ]
85+ name = devInfo[1 ]
86+ url = ' https://github.com/' + devInfo[0 ]
87+ roles = [" Maintainer" ]
9588 }
9689 }
9790 }
9891 }
9992 }
10093
101- signing {
102- useInMemoryPgpKeys(System . getenv(' PGP_PRIVATE_KEY' ), System . getenv(' PGP_KEY_PASSPHRASE' ))
103- sign publishing. publications. mavenJava
104- }
105-
10694 dependencies {
10795 implementation group : ' org.apache.commons' , name : ' commons-lang3' , version : ' 3.19.0'
10896 implementation group : ' commons-validator' , name : ' commons-validator' , version : " 1.10.0"
@@ -134,6 +122,14 @@ subprojects {
134122 }
135123 }
136124 }
125+
126+ afterEvaluate {
127+ // Work around Gradle 8.14.x implicit-dependency validation:
128+ // generateMetadataFileForMavenPublication must run after plainJavadocJar.
129+ tasks. matching { it. name == " generateMetadataFileForMavenPublication" }. configureEach {
130+ dependsOn(tasks. named(" plainJavadocJar" ))
131+ }
132+ }
137133}
138134
139135task jacocoTestReport (type : JacocoReport ) {
0 commit comments