Skip to content

Commit 7c7f0cf

Browse files
committed
Migrate to com.vanniktech.maven.publish.
1 parent 2789f67 commit 7c7f0cf

3 files changed

Lines changed: 45 additions & 65 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ jobs:
5353
- name: Set up Gradle
5454
uses: gradle/actions/setup-gradle@v6
5555
- name: Publish conformance tests snapshot
56-
run: ./gradlew publishConformanceTestsPublicationToSonatypeRepository --no-configuration-cache
56+
run: ./gradlew publishConformanceTestsPublicationToMavenCentralRepository --no-configuration-cache
5757
env:
58-
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.sonatype_username }}
59-
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.sonatype_password }}
58+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.sonatype_username }}
59+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.sonatype_password }}
6060

6161
reference-checker-tests:
6262
name: Run Reference Checker Tests

‎build.gradle‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ plugins {
1818
id 'java-library'
1919
id 'com.diffplug.spotless' version '8.8.0'
2020
id 'com.github.node-gradle.node' version '7.1.0'
21-
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' apply false
21+
id 'com.vanniktech.maven.publish' version '0.37.0'
2222
id 'biz.aQute.bnd.builder' version '7.3.0'
2323
}
2424

@@ -37,16 +37,11 @@ apply from: "gradle/format.gradle"
3737
apply from: "gradle/publish.gradle"
3838

3939
java {
40-
if (javaVersion.canCompileOrRun(21)) {
41-
withJavadocJar()
42-
}
43-
withSourcesJar()
44-
4540
sourceCompatibility = 8
4641
targetCompatibility = 8
4742
// but compile against newer JDK libraries so that we can use @Target({..., MODULE})
4843

49-
tasks.named('sourcesJar') {
44+
tasks.matching { it.name == 'sourcesJar' }.configureEach {
5045
exclude('**.class')
5146
}
5247
}

‎gradle/publish.gradle‎

Lines changed: 40 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,49 @@
1818

1919
apply plugin: 'maven-publish'
2020
apply plugin: 'signing'
21-
apply plugin: 'io.github.gradle-nexus.publish-plugin'
21+
apply plugin: 'com.vanniktech.maven.publish'
2222

23-
publishing {
24-
publications {
25-
mavenJava(MavenPublication) {
26-
pom {
27-
groupId = 'org.jspecify'
28-
artifactId = 'jspecify'
29-
name = 'JSpecify annotations'
30-
description = 'An artifact of well-named and well-specified annotations to power static analysis checks'
31-
url = 'https://jspecify.dev/'
32-
from components.java
33-
licenses {
34-
license {
35-
name = 'The Apache License, Version 2.0'
36-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
37-
}
38-
}
39-
scm {
40-
connection = 'scm:git:[email protected]:jspecify/jspecify.git'
41-
developerConnection = 'scm:git:[email protected]:jspecify/jspecify.git'
42-
url = 'https://github.com/jspecify/jspecify/'
43-
}
44-
developers {
45-
// These are here only because Sonatype requires us to list someone.
46-
// Any project member is welcome to add themselves if they want to.
47-
developer {
48-
id = 'kevinb9n'
49-
name = 'Kevin Bourrillion'
50-
51-
}
52-
developer {
53-
id = 'netdpb'
54-
name = 'David P. Baker'
55-
56-
organization = 'Google'
57-
timezone = 'America/New_York'
58-
}
59-
developer {
60-
id = 'cpovirk'
61-
name = 'Chris Povirk'
62-
63-
organization = 'Google'
64-
timezone = 'America/New_York'
65-
}
66-
}
23+
mavenPublishing {
24+
publishToMavenCentral()
25+
signAllPublications()
26+
27+
pom {
28+
name = 'JSpecify annotations'
29+
description = 'An artifact of well-named and well-specified annotations to power static analysis checks'
30+
url = 'https://jspecify.dev/'
31+
licenses {
32+
license {
33+
name = 'The Apache License, Version 2.0'
34+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
6735
}
6836
}
69-
}
70-
}
71-
72-
nexusPublishing {
73-
repositories {
74-
// see https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
75-
sonatype {
76-
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
77-
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
37+
scm {
38+
connection = 'scm:git:[email protected]:jspecify/jspecify.git'
39+
developerConnection = 'scm:git:[email protected]:jspecify/jspecify.git'
40+
url = 'https://github.com/jspecify/jspecify/'
41+
}
42+
developers {
43+
// These are here only because Sonatype requires us to list someone.
44+
// Any project member is welcome to add themselves if they want to.
45+
developer {
46+
id = 'kevinb9n'
47+
name = 'Kevin Bourrillion'
48+
49+
}
50+
developer {
51+
id = 'netdpb'
52+
name = 'David P. Baker'
53+
54+
organization = 'Google'
55+
timezone = 'America/New_York'
56+
}
57+
developer {
58+
id = 'cpovirk'
59+
name = 'Chris Povirk'
60+
61+
organization = 'Google'
62+
timezone = 'America/New_York'
63+
}
7864
}
7965
}
8066
}
@@ -84,7 +70,6 @@ def pgpPassword = findProperty('pgpPassword')
8470

8571
signing {
8672
useInMemoryPgpKeys(privateKey, pgpPassword)
87-
sign publishing.publications.mavenJava
8873
}
8974

9075
tasks.withType(Sign).configureEach {

0 commit comments

Comments
 (0)