Skip to content

Commit 3e27b6b

Browse files
committed
HSEARCH-5351 Switch to JReleaser for nexus publishing
(cherry picked from commit 46f8046)
1 parent 2b258c7 commit 3e27b6b

File tree

9 files changed

+31
-132
lines changed

9 files changed

+31
-132
lines changed

.release/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# The folder into which we checkout our release scripts into
2+
*
3+
!.gitignore

build/config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<description>Hibernate Search common build configuration files</description>
2020

2121
<properties>
22-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
22+
<deploy.skip>true</deploy.skip>
2323
<jqassistant.skip>true</jqassistant.skip>
2424

2525
<!--

build/parents/internal/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<properties>
2424
<!-- Do not publish internal modules -->
25-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
25+
<deploy.skip>true</deploy.skip>
2626
<!--
2727
Skip javadoc generation for internal modules: we don't want to publish them.
2828
Note this shouldn't be necessary because we don't even use the maven-javadoc-plugin

build/parents/public/pom.xml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -320,35 +320,5 @@
320320
</plugins>
321321
</build>
322322
</profile>
323-
<profile>
324-
<id>release</id>
325-
<activation>
326-
<property>
327-
<name>performRelease</name>
328-
<value>true</value>
329-
</property>
330-
</activation>
331-
<build>
332-
<plugins>
333-
<plugin>
334-
<groupId>org.apache.maven.plugins</groupId>
335-
<artifactId>maven-gpg-plugin</artifactId>
336-
<executions>
337-
<execution>
338-
<id>sign-artifacts</id>
339-
<phase>verify</phase>
340-
<goals>
341-
<goal>sign</goal>
342-
</goals>
343-
<configuration>
344-
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
345-
<bestPractices>true</bestPractices>
346-
</configuration>
347-
</execution>
348-
</executions>
349-
</plugin>
350-
</plugins>
351-
</build>
352-
</profile>
353323
</profiles>
354324
</project>

build/reports/pom.xml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -154,43 +154,6 @@
154154
</dependency>
155155
</dependencies>
156156

157-
<build>
158-
<plugins>
159-
<!--
160-
Hack to deploy in the "reports" module without deploying the "reports" module itself.
161-
The default lifecycle bindings of the plugin is to "stage locally" every artifact throughout
162-
the maven execution, and only actually deploy the "locally staged" artifacts
163-
in the very last executed module, which happens to be this "reports" module.
164-
However, this "reports" module does not generate any artifact we want to deploy.
165-
Thus, we'd like to prevent even its POM from being deployed: just deploy the "locally staged" artifacts,
166-
without adding the POM from the "reports" module to these artifacts.
167-
The default lifecycle bindings of the plugin does not offer a configuration option to do that,
168-
so we have to explicitly bind it
169-
-->
170-
<plugin>
171-
<groupId>org.sonatype.plugins</groupId>
172-
<artifactId>nexus-staging-maven-plugin</artifactId>
173-
<extensions>false</extensions>
174-
<!-- The <configuration> element is inherited from the parent module. -->
175-
<executions>
176-
<!-- Skip the default deployment, as explained above we don't want it. -->
177-
<execution>
178-
<id>default-deploy</id>
179-
<phase>none</phase>
180-
</execution>
181-
<!-- ... but execute the deferred deployment for the other modules -->
182-
<execution>
183-
<id>deferred-deploy</id>
184-
<phase>deploy</phase>
185-
<goals>
186-
<goal>deploy-staged</goal>
187-
</goals>
188-
</execution>
189-
</executions>
190-
</plugin>
191-
</plugins>
192-
</build>
193-
194157
<profiles>
195158
<profile>
196159
<id>coverage</id>

ci/release/Jenkinsfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ pipeline {
6262

6363
def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
6464
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
65+
env.JRELEASER_DRY_RUN = params.RELEASE_DRY_RUN
6566
echo "Performing full release for version ${releaseVersion.toString()}"
6667

6768
withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
@@ -70,13 +71,21 @@ pipeline {
7071
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
7172
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin)
7273
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
73-
string(credentialsId: 'release.gpg.passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) {
74+
string(credentialsId: 'release.gpg.passphrase', variable: 'JRELEASER_GPG_PASSPHRASE'),
75+
// TODO: HSEARCH-5354
76+
// Once we switch to maven-central publishing (from nexus2) we need to add a new credentials
77+
// to use the following env variable names to set the user/password:
78+
// JRELEASER_MAVENCENTRAL_USERNAME
79+
// JRELEASER_MAVENCENTRAL_TOKEN
80+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'JRELEASER_NEXUS2_PASSWORD', usernameVariable: 'JRELEASER_NEXUS2_USERNAME'),
81+
string(credentialsId: 'Hibernate-CI.github.com', variable: 'JRELEASER_GITHUB_TOKEN')]) {
7482
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
7583
sh 'cat $HOME/.ssh/config'
76-
sh 'git clone https://github.com/hibernate/hibernate-noorm-release-scripts.git'
77-
env.RELEASE_GPG_HOMEDIR = env.WORKSPACE_TMP + '/.gpg'
84+
dir('.release/scripts') {
85+
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git .'
86+
}
7887
sh """
79-
bash -xe hibernate-noorm-release-scripts/release.sh ${params.RELEASE_DRY_RUN ? '-d' : ''} \
88+
bash -xe .release/scripts/release.sh -j ${params.RELEASE_DRY_RUN ? '-d' : ''} \
8089
search ${releaseVersion.toString()} ${developmentVersion.toString()}
8190
"""
8291
}

distribution/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<properties>
2525
<!-- Skip artifact deployment: we publish through other means. -->
26-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
26+
<deploy.skip>true</deploy.skip>
2727
</properties>
2828

2929
<dependencies>

distribution/src/main/assembly/dist.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@
192192
<exclude>copyright.txt</exclude>
193193
<exclude>lgpl.txt</exclude>
194194

195-
<!-- only needed for documentation and helper scripts, no need to include them -->
196-
<exclude>hibernate-noorm-release-scripts/**</exclude>
195+
<!-- only needed for documentation and helper scripts, no need to include them -->
196+
<exclude>.release/**</exclude>
197197

198198
<!-- actual files which should be ignored -->
199199
<exclude>.git</exclude>

pom.xml

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@
381381
<version.jar.plugin>3.3.0</version.jar.plugin>
382382
<version.javadoc.plugin>3.5.0</version.javadoc.plugin>
383383
<version.jdeps.plugin>0.5.1</version.jdeps.plugin>
384-
<version.nexus-staging.plugin>1.6.13</version.nexus-staging.plugin>
385384
<version.processor.plugin>4.5-jdk8</version.processor.plugin>
386385
<version.project-info.plugin>3.4.5</version.project-info.plugin>
387386
<version.resources.plugin>3.3.1</version.resources.plugin>
@@ -396,7 +395,6 @@
396395
<version.moditect.plugin>1.0.0.RC2</version.moditect.plugin>
397396
<version.sonar.plugin>3.9.1.2184</version.sonar.plugin>
398397
<version.scripting.plugin>3.0.0</version.scripting.plugin>
399-
<version.gpg.plugin>3.1.0</version.gpg.plugin>
400398
<version.org.apache.groovy.groovy-jsr223>4.0.12</version.org.apache.groovy.groovy-jsr223>
401399
<version.com.puppycrawl.tools.checkstyle>10.9.3</version.com.puppycrawl.tools.checkstyle>
402400
<version.versions.plugin>2.12.0</version.versions.plugin>
@@ -425,12 +423,13 @@
425423

426424
<!-- Repository Deployment URLs -->
427425

428-
<ossrh.releases.repo.id>ossrh</ossrh.releases.repo.id>
429-
<ossrh.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</ossrh.releases.repo.url>
430-
<ossrh.releases.repo.baseUrl>https://oss.sonatype.org/</ossrh.releases.repo.baseUrl>
426+
<local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
427+
<local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
431428
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
432429
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
433430

431+
<deploy.skip>false</deploy.skip>
432+
434433
<!-- Build settings -->
435434

436435
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -1687,44 +1686,6 @@
16871686
</execution>
16881687
</executions>
16891688
</plugin>
1690-
<!-- Skip the deploy plugin explicitly: we use nexus-staging-maven-plugin instead -->
1691-
<plugin>
1692-
<groupId>org.apache.maven.plugins</groupId>
1693-
<artifactId>maven-deploy-plugin</artifactId>
1694-
<configuration>
1695-
<skip>true</skip>
1696-
</configuration>
1697-
</plugin>
1698-
<!--
1699-
Configure the nexus-staging-maven-plugin explicitly (without <extension>true</extension>)
1700-
in order to work around a problem in the "reports" module (see that module's POM for more info).
1701-
-->
1702-
<plugin>
1703-
<groupId>org.sonatype.plugins</groupId>
1704-
<artifactId>nexus-staging-maven-plugin</artifactId>
1705-
<extensions>false</extensions><!-- This is essential: do not put true here -->
1706-
<configuration>
1707-
<serverId>${ossrh.releases.repo.id}</serverId>
1708-
<!-- The following, by default, is only used for actual releases, not for snapshot deployments -->
1709-
<nexusUrl>${ossrh.releases.repo.baseUrl}</nexusUrl>
1710-
<!-- oss.sonatype.org has been very slow when closing repositories lately;
1711-
let's raise the timeout until we switch to s01.sonatype.org -->
1712-
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
1713-
</configuration>
1714-
<executions>
1715-
<execution>
1716-
<id>default-deploy</id>
1717-
<phase>deploy</phase>
1718-
<goals>
1719-
<!--
1720-
This will only put artifacts in a staging directory.
1721-
See the "reports" module for actual deployment, at the end of the build.
1722-
-->
1723-
<goal>deploy</goal>
1724-
</goals>
1725-
</execution>
1726-
</executions>
1727-
</plugin>
17281689
<plugin>
17291690
<groupId>org.apache.maven.plugins</groupId>
17301691
<artifactId>maven-enforcer-plugin</artifactId>
@@ -1875,11 +1836,6 @@
18751836
<artifactId>maven-processor-plugin</artifactId>
18761837
<version>${version.processor.plugin}</version>
18771838
</plugin>
1878-
<plugin>
1879-
<groupId>org.sonatype.plugins</groupId>
1880-
<artifactId>nexus-staging-maven-plugin</artifactId>
1881-
<version>${version.nexus-staging.plugin}</version>
1882-
</plugin>
18831839
<plugin>
18841840
<groupId>org.apache.maven.plugins</groupId>
18851841
<artifactId>maven-assembly-plugin</artifactId>
@@ -1908,6 +1864,9 @@
19081864
<groupId>org.apache.maven.plugins</groupId>
19091865
<artifactId>maven-deploy-plugin</artifactId>
19101866
<version>${version.deploy.plugin}</version>
1867+
<configuration>
1868+
<skip>${deploy.skip}</skip>
1869+
</configuration>
19111870
</plugin>
19121871
<plugin>
19131872
<groupId>org.apache.maven.plugins</groupId>
@@ -2393,11 +2352,6 @@
23932352
</dependency>
23942353
</dependencies>
23952354
</plugin>
2396-
<plugin>
2397-
<groupId>org.apache.maven.plugins</groupId>
2398-
<artifactId>maven-gpg-plugin</artifactId>
2399-
<version>${version.gpg.plugin}</version>
2400-
</plugin>
24012355
<plugin>
24022356
<artifactId>maven-antrun-plugin</artifactId>
24032357
<version>3.1.0</version>
@@ -2466,9 +2420,9 @@
24662420

24672421
<distributionManagement>
24682422
<repository>
2469-
<id>${ossrh.releases.repo.id}</id>
2470-
<name>OSSRH Releases Repository</name>
2471-
<url>${ossrh.releases.repo.url}</url>
2423+
<id>${local.staging.releases.repo.id}</id>
2424+
<name>Local Staging Directory Releases Repository</name>
2425+
<url>${local.staging.releases.repo.url}</url>
24722426
</repository>
24732427
<snapshotRepository>
24742428
<id>${ossrh.snapshots.repo.id}</id>

0 commit comments

Comments
 (0)