Skip to content

Commit ff724a9

Browse files
authored
Simplify Central deployment & update Release Process guide (#2902)
* Simplify Central deployment & update Release Process guide * Move central-publishing-maven-plugin outside profiles Plugin only runs for `deploy` goal anyway so no need to have this in release profile. Additionally, the other modules (currently only `gson`) declare it as regular plugin, not inside a profile, as well.
1 parent d139ba9 commit ff724a9

File tree

9 files changed

+56
-133
lines changed

9 files changed

+56
-133
lines changed

ReleaseProcess.md

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ The following is a step-by-step procedure for releasing a new version of Google-
44

55
1. Go through all open bugs and identify which will be fixed in this release. Mark all others with an appropriate release tag. Identify duplicates, and close the bugs that will never be fixed. Fix all bugs for the release, and mark them fixed.
66
1. Ensure all changelists are code-reviewed and have +1
7+
1. Make sure your `${user.home}/.m2/settings.xml` contains the [Maven Central credentials](https://central.sonatype.org/publish/publish-portal-maven/#credentials)
78
1. `cd gson` to the parent directory; ensure there are no open files and all changes are committed.
89
1. Run `mvn release:clean`
910
1. Start the release: `mvn release:prepare`
1011
- Answer questions: usually the defaults are fine. Try to follow [Semantic Versioning](https://semver.org/) when choosing the release version number.
1112
- This will do a full build, change version from `-SNAPSHOT` to the released version, commit and create the tags. It will then change the version to `-SNAPSHOT` for the next release.
1213
1. Complete the release: `mvn release:perform`
13-
1. [Log in to Nexus repository manager](https://oss.sonatype.org/index.html#welcome) at Sonatype and close the staging repository for Gson.
14-
1. Download and sanity check all downloads. Do not skip this step! Once you release the staging repository, there is no going back. It will get synced with Maven Central and you will not be able to update or delete anything. Your only recourse will be to release a new version of Gson and hope that no one uses the old one.
15-
1. Release the staging repository for Gson. Gson will now get synced to Maven Central with-in the next hour. For issues consult [Sonatype Guide](https://central.sonatype.org/publish/release/).
16-
1. Create a [GitHub release](https://github.com/google/gson/releases) for the new version. You can let GitHub [automatically generate the description for the release](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes), but you should edit it manually to point out the most important changes and potentially incompatible changes.
14+
1. [Log in to the Central Portal](https://central.sonatype.com/)
15+
1. Download and sanity check all files.\
16+
Do not skip this step! Once you release the staging repository, there is no going back. It will get synced with Maven Central and you will not be able to update or delete anything. Your only recourse will be to release a new version of Gson and hope that no one uses the old one.
17+
1. Publish the new Gson version in the Central Portal.\
18+
Gson will now get synced to Maven Central within the next hour.
19+
1. Create a [GitHub release](https://github.com/google/gson/releases) for the new version.\
20+
You can let GitHub [automatically generate the description for the release](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes), but you should edit it manually to point out the most important changes and potentially incompatible changes.
1721
1. Update version references in (version might be referenced multiple times):
1822
- [`README.md`](README.md)
1923
- [`UserGuide.md`](UserGuide.md)
@@ -24,62 +28,49 @@ The following is a step-by-step procedure for releasing a new version of Google-
2428

2529
Important: When aborting a release / rolling back release preparations, make sure to also revert all changes to files which were done during the release (e.g. automatic replacement of version references).
2630

27-
## Configuring a machine for deployment to Sonatype Repository
28-
29-
This section was borrowed heavily from [Doclava release process](https://code.google.com/archive/p/doclava/wikis/ProcessRelease.wiki).
30-
31-
1. Install/Configure GPG following this [guide](https://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/).
32-
1. [Create encrypted passwords](https://maven.apache.org/guides/mini/guide-encryption.html).
33-
1. Create `~/.m2/settings.xml` similar to as described in [Doclava release process](https://code.google.com/p/doclava/wiki/ProcessRelease).
34-
1. Now for deploying a snapshot repository, use `mvn deploy`.
35-
36-
## Getting Maven Publishing Privileges
37-
38-
See [OSSRH Publish Guide](https://central.sonatype.org/publish/publish-guide/).
39-
4031
## Testing Maven release workflow locally
4132

4233
The following describes how to perform the steps of the release locally to verify that they work as desired.
4334

44-
**Warning:** Be careful with this, these steps might be outdated or incomplete. Doublecheck that you are working on a copy of your local Gson Git repository and make sure you have followed all steps. To be safe you can also temporarily turn off your internet connection to avoid accidentally pushing changes to the real remote Git or Maven repository.\
45-
As an alternative to the steps described below you can instead [perform a dry run](https://maven.apache.org/maven-release/maven-release-plugin/usage.html#do-a-dry-run), though this might not behave identical to a real release.
35+
> [!CAUTION]\
36+
> Be careful with this, these steps might be outdated or incomplete. Double-check that you are working on a copy of your local Gson Git repository and make sure you have followed all steps. To be safe you can also temporarily turn off your internet connection to avoid accidentally pushing changes to the real remote Git or Maven repository.\
37+
> As an alternative to the steps described below you can instead [perform a dry run](https://maven.apache.org/maven-release/maven-release-plugin/usage.html#do-a-dry-run), though this might not behave identical to a real release.
4638
4739
1. Make a copy of your local Gson Git repository and only work with that copy
48-
2. Make sure you are on the `main` branch
49-
3. Create a temp directory outside the Gson directory\
40+
1. Make sure you are on the `main` branch
41+
1. Create a temp directory outside the Gson directory\
5042
In the following steps this will be called `#gson-remote-temp#`; replace this with the actual absolute file path of the directory, using only forward slashes. For example under Windows `C:\my-dir` becomes `C:/my-dir`.
51-
4. Create the directory `#gson-remote-temp#/git-repo`
52-
5. In that directory run
43+
1. Create the directory `#gson-remote-temp#/git-repo`
44+
1. In that directory run
5345

5446
```sh
5547
git init --bare --initial-branch=main .
5648
```
5749

58-
6. Create the directory `#gson-remote-temp#/maven-repo`
59-
7. Edit the root `pom.xml` of Gson
50+
1. Edit the root `pom.xml` of Gson
6051
1. Change the `<developerConnection>` to
6152

6253
```txt
6354
scm:git:file:///#gson-remote-temp#/git-repo
6455
```
6556

66-
2. Change the `<url>` of the `<distributionManagement>` to
57+
1. For the `central-publishing-maven-plugin` **inside the `<pluginManagement>`**, add the following to its `<configuration>`
6758

68-
```txt
69-
file:///#gson-remote-temp#/maven-repo
59+
```xml
60+
<skipPublishing>true</skipPublishing>
7061
```
7162

72-
3. If you don't want to use GPG, remove the `maven-gpg-plugin` entry from the 'release' profile.\
63+
1. If you don't want to use GPG, remove the `maven-gpg-plugin` entry from the 'release' profile.\
7364
There is also an entry under `<pluginManagement>`; you can remove that as well.
74-
8. Commit the changes using Git
75-
9. Change the remote repository of the Git project
65+
1. Commit the changes using Git
66+
1. Change the remote repository of the Git project
7667
7768
<!-- Uses `txt` instead of `sh` to avoid the `#` being highlighted in some way -->
7869
```txt
7970
git remote set-url origin file:///#gson-remote-temp#/git-repo
8071
```
8172
82-
10. Push the changes
73+
1. Push the changes
8374
8475
```sh
8576
git push origin main
@@ -91,16 +82,18 @@ Now you can perform the steps of the release:
9182
mvn release:clean
9283
```
9384
94-
2. ```sh
85+
1. ```sh
9586
mvn release:prepare
9687
```
9788
98-
3. ```sh
89+
1. ```sh
9990
mvn release:perform
10091
```
10192
102-
4. Verify that `#gson-remote-temp#/git-repo` and `#gson-remote-temp#/maven-repo` contain all the desired changes
103-
5. Afterwards delete all Gson files under `${user.home}/.m2/repository/com/google/code/gson` which have been installed in your local Maven repository during the release.\
93+
1. Verify that `#gson-remote-temp#/git-repo` contains the desired changes
94+
1. Verify that in the Gson project directory where you performed the release, the `target/checkout/target/central-publishing/central-bundle.zip` file contains the desired artifacts\
95+
Currently that is the artifacts for `gson-parent` and `gson`.
96+
1. Afterwards delete all Gson files under `${user.home}/.m2/repository/com/google/code/gson` which have been installed in your local Maven repository during the release.\
10497
Otherwise Maven might not download the real Gson artifacts with these version numbers, once they are released.
10598
10699
## Running Benchmarks or Tests on Android

extras/pom.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
<!-- Make the build reproducible, see root `pom.xml` -->
3333
<!-- This is duplicated here because that is recommended by `artifact:check-buildplan` -->
3434
<project.build.outputTimestamp>2025-09-10T20:39:14Z</project.build.outputTimestamp>
35-
36-
<!-- Overwrite property from parent; this module is currently not deployed -->
37-
<gson.isInternalModule>true</gson.isInternalModule>
3835
</properties>
3936

4037
<licenses>
@@ -90,19 +87,4 @@
9087
<scm>
9188
<tag>gson-extras-2.12.1</tag>
9289
</scm>
93-
94-
<build>
95-
<plugins>
96-
<plugin>
97-
<groupId>org.sonatype.central</groupId>
98-
<artifactId>central-publishing-maven-plugin</artifactId>
99-
<executions>
100-
<execution>
101-
<id>injected-central-publishing</id>
102-
<phase>none</phase>
103-
</execution>
104-
</executions>
105-
</plugin>
106-
</plugins>
107-
</build>
10890
</project>

gson/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,15 @@
334334
<excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames>
335335
</configuration>
336336
</plugin>
337+
338+
<!--
339+
Plugin for deploying to Maven Central
340+
(configured in parent POM)
341+
-->
342+
<plugin>
343+
<groupId>org.sonatype.central</groupId>
344+
<artifactId>central-publishing-maven-plugin</artifactId>
345+
</plugin>
337346
</plugins>
338347
</build>
339348

metrics/pom.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,4 @@
7676
<organization>Google Inc.</organization>
7777
</developer>
7878
</developers>
79-
80-
<build>
81-
<plugins>
82-
<plugin>
83-
<groupId>org.sonatype.central</groupId>
84-
<artifactId>central-publishing-maven-plugin</artifactId>
85-
<executions>
86-
<execution>
87-
<id>injected-central-publishing</id>
88-
<phase>none</phase>
89-
</execution>
90-
</executions>
91-
</plugin>
92-
</plugins>
93-
</build>
9479
</project>

pom.xml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
<!-- These properties are to be overwritten by the Maven modules -->
4949
<!-- Whether this module is an integration test module -->
5050
<gson.isTestModule>false</gson.isTestModule>
51-
<!-- Whether this module is internal and currently not deployed -->
52-
<gson.isInternalModule>${gson.isTestModule}</gson.isInternalModule>
5351
</properties>
5452

5553
<!-- These attributes specify that the URLs should be inherited by the modules as is, to avoid constructing
@@ -61,13 +59,6 @@
6159
<tag>HEAD</tag>
6260
</scm>
6361

64-
<distributionManagement>
65-
<snapshotRepository>
66-
<id>sonatype-nexus-snapshots</id>
67-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
68-
</snapshotRepository>
69-
</distributionManagement>
70-
7162
<developers>
7263
<developer>
7364
<id>google</id>
@@ -212,6 +203,15 @@
212203
</execution>
213204
</executions>
214205
</plugin>
206+
207+
<!-- Publish gson-parent to Maven Central on `deploy` (common configuration is defined in `pluginManagement`) -->
208+
<plugin>
209+
<groupId>org.sonatype.central</groupId>
210+
<artifactId>central-publishing-maven-plugin</artifactId>
211+
<!-- Set `inherited=false` to only apply this execution to gson-parent;
212+
if modules should be deployed, it has to be configured explicitly for them -->
213+
<inherited>false</inherited>
214+
</plugin>
215215
</plugins>
216216

217217
<pluginManagement>
@@ -375,6 +375,15 @@
375375
<skip>${gson.isTestModule}</skip>
376376
</configuration>
377377
</plugin>
378+
<plugin>
379+
<groupId>org.apache.maven.plugins</groupId>
380+
<artifactId>maven-deploy-plugin</artifactId>
381+
<version>3.1.4</version>
382+
<configuration>
383+
<!-- skip because central-publishing-maven-plugin is used for deployment -->
384+
<skip>true</skip>
385+
</configuration>
386+
</plugin>
378387
<plugin>
379388
<groupId>org.sonatype.central</groupId>
380389
<artifactId>central-publishing-maven-plugin</artifactId>
@@ -601,10 +610,6 @@
601610
</execution>
602611
</executions>
603612
</plugin>
604-
<plugin>
605-
<groupId>org.sonatype.central</groupId>
606-
<artifactId>central-publishing-maven-plugin</artifactId>
607-
</plugin>
608613
</plugins>
609614
</build>
610615
</profile>

proto/pom.xml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
<project.build.outputTimestamp>2025-09-10T20:39:14Z</project.build.outputTimestamp>
3333

3434
<protobufVersion>4.32.0</protobufVersion>
35-
36-
<!-- Overwrite property from parent; this module is currently not deployed -->
37-
<gson.isInternalModule>true</gson.isInternalModule>
3835
</properties>
3936

4037
<licenses>
@@ -102,17 +99,6 @@
10299
</execution>
103100
</executions>
104101
</plugin>
105-
106-
<plugin>
107-
<groupId>org.sonatype.central</groupId>
108-
<artifactId>central-publishing-maven-plugin</artifactId>
109-
<executions>
110-
<execution>
111-
<id>injected-central-publishing</id>
112-
<phase>none</phase>
113-
</execution>
114-
</executions>
115-
</plugin>
116102
</plugins>
117103
</build>
118104

test-graal-native-image/pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,6 @@
112112
</execution>
113113
</executions>
114114
</plugin>
115-
116-
<plugin>
117-
<groupId>org.sonatype.central</groupId>
118-
<artifactId>central-publishing-maven-plugin</artifactId>
119-
<executions>
120-
<execution>
121-
<id>injected-central-publishing</id>
122-
<phase>none</phase>
123-
</execution>
124-
</executions>
125-
</plugin>
126115
</plugins>
127116
</build>
128117

test-jpms/pom.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,4 @@
5050
<scope>test</scope>
5151
</dependency>
5252
</dependencies>
53-
54-
<build>
55-
<plugins>
56-
<plugin>
57-
<groupId>org.sonatype.central</groupId>
58-
<artifactId>central-publishing-maven-plugin</artifactId>
59-
<executions>
60-
<execution>
61-
<id>injected-central-publishing</id>
62-
<phase>none</phase>
63-
</execution>
64-
</executions>
65-
</plugin>
66-
</plugins>
67-
</build>
6853
</project>

test-shrinker/pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,6 @@
208208
</execution>
209209
</executions>
210210
</plugin>
211-
212-
<plugin>
213-
<groupId>org.sonatype.central</groupId>
214-
<artifactId>central-publishing-maven-plugin</artifactId>
215-
<executions>
216-
<execution>
217-
<id>injected-central-publishing</id>
218-
<phase>none</phase>
219-
</execution>
220-
</executions>
221-
</plugin>
222211
</plugins>
223212
</build>
224213
</project>

0 commit comments

Comments
 (0)