Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 29 additions & 36 deletions ReleaseProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ The following is a step-by-step procedure for releasing a new version of Google-

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.
1. Ensure all changelists are code-reviewed and have +1
1. Make sure your `${user.home}/.m2/settings.xml` contains the [Maven Central credentials](https://central.sonatype.org/publish/publish-portal-maven/#credentials)
1. `cd gson` to the parent directory; ensure there are no open files and all changes are committed.
1. Run `mvn release:clean`
1. Start the release: `mvn release:prepare`
- Answer questions: usually the defaults are fine. Try to follow [Semantic Versioning](https://semver.org/) when choosing the release version number.
- 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.
1. Complete the release: `mvn release:perform`
1. [Log in to Nexus repository manager](https://oss.sonatype.org/index.html#welcome) at Sonatype and close the staging repository for Gson.
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.
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/).
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.
1. [Log in to the Central Portal](https://central.sonatype.com/)
1. Download and sanity check all files.\
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.
1. Publish the new Gson version in the Central Portal.\
Gson will now get synced to Maven Central within the next hour.
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.
1. Update version references in (version might be referenced multiple times):
- [`README.md`](README.md)
- [`UserGuide.md`](UserGuide.md)
Expand All @@ -24,62 +28,49 @@ The following is a step-by-step procedure for releasing a new version of Google-

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).

## Configuring a machine for deployment to Sonatype Repository

This section was borrowed heavily from [Doclava release process](https://code.google.com/archive/p/doclava/wikis/ProcessRelease.wiki).

1. Install/Configure GPG following this [guide](https://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/).
1. [Create encrypted passwords](https://maven.apache.org/guides/mini/guide-encryption.html).
1. Create `~/.m2/settings.xml` similar to as described in [Doclava release process](https://code.google.com/p/doclava/wiki/ProcessRelease).
1. Now for deploying a snapshot repository, use `mvn deploy`.
Comment on lines -27 to -34
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because it is most likely pretty outdated / there is probably better or more up to date information available.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK


## Getting Maven Publishing Privileges

See [OSSRH Publish Guide](https://central.sonatype.org/publish/publish-guide/).

## Testing Maven release workflow locally

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

**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.\
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.
> [!CAUTION]\
> 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.\
> 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.

1. Make a copy of your local Gson Git repository and only work with that copy
2. Make sure you are on the `main` branch
3. Create a temp directory outside the Gson directory\
1. Make sure you are on the `main` branch
1. Create a temp directory outside the Gson directory\
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`.
4. Create the directory `#gson-remote-temp#/git-repo`
5. In that directory run
1. Create the directory `#gson-remote-temp#/git-repo`
1. In that directory run

```sh
git init --bare --initial-branch=main .
```

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

```txt
scm:git:file:///#gson-remote-temp#/git-repo
```

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

```txt
file:///#gson-remote-temp#/maven-repo
```xml
<skipPublishing>true</skipPublishing>
```

3. If you don't want to use GPG, remove the `maven-gpg-plugin` entry from the 'release' profile.\
1. If you don't want to use GPG, remove the `maven-gpg-plugin` entry from the 'release' profile.\
There is also an entry under `<pluginManagement>`; you can remove that as well.
8. Commit the changes using Git
9. Change the remote repository of the Git project
1. Commit the changes using Git
1. Change the remote repository of the Git project

<!-- Uses `txt` instead of `sh` to avoid the `#` being highlighted in some way -->
```txt
git remote set-url origin file:///#gson-remote-temp#/git-repo
```

10. Push the changes
1. Push the changes

```sh
git push origin main
Expand All @@ -91,16 +82,18 @@ Now you can perform the steps of the release:
mvn release:clean
```

2. ```sh
1. ```sh
mvn release:prepare
```

3. ```sh
1. ```sh
mvn release:perform
```

4. Verify that `#gson-remote-temp#/git-repo` and `#gson-remote-temp#/maven-repo` contain all the desired changes
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.\
1. Verify that `#gson-remote-temp#/git-repo` contains the desired changes
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\
Currently that is the artifacts for `gson-parent` and `gson`.
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.\
Otherwise Maven might not download the real Gson artifacts with these version numbers, once they are released.

## Running Benchmarks or Tests on Android
Expand Down
18 changes: 0 additions & 18 deletions extras/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
<!-- Make the build reproducible, see root `pom.xml` -->
<!-- This is duplicated here because that is recommended by `artifact:check-buildplan` -->
<project.build.outputTimestamp>2025-09-10T20:39:14Z</project.build.outputTimestamp>

<!-- Overwrite property from parent; this module is currently not deployed -->
<gson.isInternalModule>true</gson.isInternalModule>
</properties>

<licenses>
Expand Down Expand Up @@ -90,19 +87,4 @@
<scm>
<tag>gson-extras-2.12.1</tag>
</scm>

<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<executions>
<execution>
<id>injected-central-publishing</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
9 changes: 9 additions & 0 deletions gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,15 @@
<excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames>
</configuration>
</plugin>

<!--
Plugin for deploying to Maven Central
(configured in parent POM)
-->
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
15 changes: 0 additions & 15 deletions metrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,4 @@
<organization>Google Inc.</organization>
</developer>
</developers>

<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<executions>
<execution>
<id>injected-central-publishing</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
31 changes: 18 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
<!-- These properties are to be overwritten by the Maven modules -->
<!-- Whether this module is an integration test module -->
<gson.isTestModule>false</gson.isTestModule>
<!-- Whether this module is internal and currently not deployed -->
<gson.isInternalModule>${gson.isTestModule}</gson.isInternalModule>
</properties>

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

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
</snapshotRepository>
Comment on lines -65 to -68
Copy link
Contributor Author

@Marcono1234 Marcono1234 Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think currently Gson publishes no snapshots, and if I understand it correctly that URL is also the default for central-publishing-maven-plugin.

Edit: See Constants.java in the plugin source (unofficial mirror code; this seems to match the official plugin code in the -sources.jar).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, yes.

</distributionManagement>

<developers>
<developer>
<id>google</id>
Expand Down Expand Up @@ -212,6 +203,15 @@
</execution>
</executions>
</plugin>

<!-- Publish gson-parent to Maven Central on `deploy` (common configuration is defined in `pluginManagement`) -->
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<!-- Set `inherited=false` to only apply this execution to gson-parent;
if modules should be deployed, it has to be configured explicitly for them -->
<inherited>false</inherited>
</plugin>
</plugins>

<pluginManagement>
Expand Down Expand Up @@ -375,6 +375,15 @@
<skip>${gson.isTestModule}</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
<configuration>
<!-- skip because central-publishing-maven-plugin is used for deployment -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
Expand Down Expand Up @@ -601,10 +610,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
Expand Down
14 changes: 0 additions & 14 deletions proto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
<project.build.outputTimestamp>2025-09-10T20:39:14Z</project.build.outputTimestamp>

<protobufVersion>4.32.0</protobufVersion>

<!-- Overwrite property from parent; this module is currently not deployed -->
<gson.isInternalModule>true</gson.isInternalModule>
</properties>

<licenses>
Expand Down Expand Up @@ -102,17 +99,6 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<executions>
<execution>
<id>injected-central-publishing</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
11 changes: 0 additions & 11 deletions test-graal-native-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,6 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<executions>
<execution>
<id>injected-central-publishing</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
15 changes: 0 additions & 15 deletions test-jpms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,4 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<executions>
<execution>
<id>injected-central-publishing</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
11 changes: 0 additions & 11 deletions test-shrinker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,6 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<executions>
<execution>
<id>injected-central-publishing</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>