Skip to content

Conversation

@Marcono1234
Copy link
Contributor

@Marcono1234 Marcono1234 commented Sep 10, 2025

Follow-up for #2900, trying to simplify the configuration and updating the Release Process guide.

The general approach that I used here is to declared the central-publishing-maven-plugin for the parent pom.xml, but with <inherited>false</inherited>. Then only the submodules which should be deployed as well (currently only gson) need to declare the plugin.

That seems to work as desired and avoids having to apply central-publishing-maven-plugin configuration for all projects which should not be deployed.
However, it does require explicitly setting skip=false for the maven-deploy-plugin. It seems otherwise for those modules which are not deployed (and don't have central-publishing-maven-plugin configured) the maven-deploy-plugin is not implicitly disabled.

I have marked this as Draft for now to discuss some of the changes first, because they might have downsides. Also, feel free to do any other changes / simplifications independently; I will resolve the merge conflicts in this PR then.

Comment on lines -65 to -68
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
</snapshotRepository>
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.

Comment on lines -27 to -34
## 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`.
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

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.
copybara-service bot pushed a commit to google/truth that referenced this pull request Sep 11, 2025
…ory/maven-snapshots.

@Marcono1234 notes [in a GSON PR](google/gson#2902 (comment)) that this appears to be the default. So let's not re-specify the default. (Compare cl/799337152.)

If this CL goes well, I'll mail a similar CL (cl/805841232) for our other projects.

RELNOTES=n/a
PiperOrigin-RevId: 805842432
copybara-service bot pushed a commit to google/truth that referenced this pull request Sep 11, 2025
…ory/maven-snapshots.

@Marcono1234 notes [in a GSON PR](google/gson#2902 (comment)) that this appears to be the default. So let's not re-specify the default. (Compare cl/799337152.)

If this CL goes well, I'll mail a similar CL (cl/805841232) for our other projects.

RELNOTES=n/a
PiperOrigin-RevId: 805870501
Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

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

Thanks, this seems a lot simpler! I think we won't know 100% for sure whether it works until the next release, but we can adjust as necessary then. (I think it would be a bit annoying for users if we made a 2.13.3 release now just to check this.)

Comment on lines -65 to -68
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
</snapshotRepository>
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.

Comment on lines -27 to -34
## 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`.
Copy link
Member

Choose a reason for hiding this comment

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

OK

@Marcono1234 Marcono1234 marked this pull request as ready for review September 11, 2025 19:28
@Marcono1234
Copy link
Contributor Author

I think we won't know 100% for sure whether it works until the next release, but we can adjust as necessary then.

I tried with the "Testing Maven release workflow locally" steps in the Release Process guide, which is probably pretty close to how it behaves for a real release. But yes you are right, we can't be completely sure. Especially also in case the central-publishing-maven-plugin is updated in the meantime.

@eamonnmcmanus
Copy link
Member

Thanks again for doing this!

@eamonnmcmanus eamonnmcmanus merged commit ff724a9 into google:main Sep 11, 2025
13 checks passed
@Marcono1234 Marcono1234 deleted the marcono1234/central-publishing-follow-up branch September 12, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants