Repository navigation
[4.0.x] Bind the central server id to Central's publishing origins and count altDeploymentRepository as a declared origin - #14103
Draft
slachiewicz wants to merge 3 commits into
Conversation
The default repository gives the id central the origin repo.maven.apache.org, which kept a settings server with that id from authenticating deployments to central.sonatype.com (HTTP 401 on snapshot publishing). The publishing origins are added only while the built-in location is the sole origin of the id. Do not fix this by dropping the default repository's origin instead: a parent POM can declare a repository central at another host, and that binding is what withholds the credentials there.
A deployment repository given on the command line as id::url was not known to the credential scoping: its server was used with a warning in the origin scope and refused in the strict scope, although the warning itself says a repository declared on the command line counts. Only the user properties of the request are read, so a POM property of the same name declares nothing.
The binding of the id central to Central's publishing origins keeps deployments configured before credential scoping working; the warning names the explicit replacement so the binding can be removed later.
slachiewicz
force-pushed
the
central-publishing-origins-4.0.x
branch
from
November 27, 2026 07:45
5ffd240 to
364c2cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A settings server with the id
centralcould not authenticate snapshot deployments to Maven Central: the default repository binds that id tohttps://repo.maven.apache.org, so its credentials were withheld fromhttps://central.sonatype.comand the deploy ended withHTTP Status: 401. The id is the defaultpublishingServerIdofcentral-publishing-maven-plugin.The id
centralis now also bound to the origins Central is published to,https://central.sonatype.comandhttps://ossrh-staging-api.central.sonatype.com, as long as the built-in location is its only origin. A mirror, a repository or a server<repositoryOrigins>that gives the id another origin takes over and nothing is added. The default repository's origin stays bound on purpose: a parent POM can declare a repositorycentralat another host, and that binding is what withholds the credentials there.When credentials are used through this binding, Maven warns once per session that the binding will be removed in a future release and names the replacements: the two origins in the server's
<repositoryOrigins>, or a server id of its own such as thepublishingServerIdofcentral-publishing-maven-plugin. Server aliases need nothing extra: the default repositorycentralis always among the request's repositories, so an aliascentralgets the same binding.A deployment repository given on the command line with
altDeploymentRepository,altReleaseDeploymentRepositoryoraltSnapshotDeploymentRepositorynow declares the origin of its id, as the existing warning already says a command-line repository does. Such a server is used without a warning, works in thestrictscope, and its credentials are no longer offered to a repository that reuses the id at another host. Only user properties are read; a POM property of the same name declares nothing.Verified:
mvn deploy:deploy -DaltDeploymentRepository=central::https://central.sonatype.com/repository/maven-snapshots/with a settings servercentralon a 4.0.x build, against a local stand-in forcentral.sonatype.com→ 401 without credentials before, deployed with credentials after. On master only the unit tests were run. The warning was run end to end on a 3.10.x build only; here it is covered by unit tests.Verified: the same command with
-DaltDeploymentRepository=sonatype-central::<url>and a settings serversonatype-centralon a 4.0.x build → one warning and refused understrictbefore; no warning and deployed understrictafter.I have not run the core ITs.