Skip to content

Commit 2198c76

Browse files
committed
* migration to central.sonatype, release scripts
using `central-publishing-maven-plugin` for maven and `org.jreleaser` for gradle.
1 parent f182fc8 commit 2198c76

File tree

4 files changed

+61
-15
lines changed

4 files changed

+61
-15
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
set -e
33
mvn -T 10 clean install
44
./plugins/idea/gradlew -b plugins/idea/build.gradle clean buildPlugin
5-
mvn -f plugins/eclipse/pom.xml clean install
5+
mvn -T 10 -f plugins/eclipse/pom.xml clean install
66
./plugins/gradle/gradlew -b plugins/gradle/build.gradle clean assemble validatePlugins publishToMavenLocal

plugins/gradle/build.gradle

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id 'java-gradle-plugin'
55
id 'groovy'
66
id 'maven-publish'
7+
id "org.jreleaser" version "1.20.0"
78
id 'signing'
89
id 'eclipse'
910
}
@@ -97,13 +98,49 @@ publishing {
9798
}
9899
}
99100
repositories {
101+
if (project.version.toString().endsWith("-SNAPSHOT")) {
102+
// snapshots are going to sonatype
103+
maven {
104+
credentials {
105+
username = System.getenv("MAVEN_USERNAME")
106+
password = System.getenv("MAVEN_PASSWORD")
107+
}
108+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
109+
}
110+
} else {
111+
// local staging repository for JReleaser
112+
maven {
113+
url = uri(layout.buildDirectory.dir("staging-deploy"))
114+
}
115+
}
116+
}
117+
}
118+
119+
120+
// https://central.sonatype.org/publish/publish-portal-gradle/
121+
jreleaser {
122+
signing {
123+
setActive("ALWAYS")
124+
armored = true
125+
}
126+
deploy {
100127
maven {
101-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
102-
def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
103-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
104-
credentials {
105-
username = System.getenv("MAVEN_USERNAME")
106-
password = System.getenv("MAVEN_PASSWORD") }
128+
mavenCentral {
129+
create("sonatype") {
130+
setActive("RELEASE")
131+
username = System.getenv("MAVEN_USERNAME")
132+
password = System.getenv("MAVEN_PASSWORD")
133+
url = "https://central.sonatype.com/api/v1/publisher"
134+
stagingRepository("build/staging-deploy")
135+
setStage("UPLOAD") // OTHERWISE it will do "publish"
136+
}
137+
}
138+
}
139+
}
140+
release {
141+
github {
142+
skipRelease = true
143+
token = "-" // must be not blank
107144
}
108145
}
109146
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

pom.xml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747

4848
<properties>
49-
<sonatypeOssDistMgmtSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots/</sonatypeOssDistMgmtSnapshotsUrl>
5049
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5150
</properties>
5251

@@ -72,6 +71,10 @@
7271
</execution>
7372
</executions>
7473
</plugin>
74+
<plugin>
75+
<groupId>org.sonatype.central</groupId>
76+
<artifactId>central-publishing-maven-plugin</artifactId>
77+
</plugin>
7578
</plugins>
7679
</build>
7780
</profile>
@@ -320,13 +323,8 @@
320323
<snapshotRepository>
321324
<id>sonatype-nexus-snapshots</id>
322325
<name>Sonatype Nexus Snapshots</name>
323-
<url>${sonatypeOssDistMgmtSnapshotsUrl}</url>
326+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
324327
</snapshotRepository>
325-
<repository>
326-
<id>sonatype-nexus-staging</id>
327-
<name>Nexus Release Repository</name>
328-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
329-
</repository>
330328
</distributionManagement>
331329
<!-- end of: entries from sonatype oss-parent-->
332330

@@ -474,6 +472,17 @@
474472
<artifactId>exec-maven-plugin</artifactId>
475473
<version>1.6.0</version>
476474
</plugin>
475+
<!-- Central publishing -->
476+
<plugin>
477+
<groupId>org.sonatype.central</groupId>
478+
<artifactId>central-publishing-maven-plugin</artifactId>
479+
<version>0.8.0</version>
480+
<extensions>true</extensions>
481+
<configuration>
482+
<publishingServerId>sonatype-nexus-snapshots</publishingServerId>
483+
<autoPublish>false</autoPublish>
484+
</configuration>
485+
</plugin>
477486
</plugins>
478487
</pluginManagement>
479488

0 commit comments

Comments
 (0)