GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Issue #13265: let a settings server declare the repository origins its credentials may be used with by slawekjaranowski · Pull Request #13275 · apache/maven Conversation
Member
Same change as #13268, for the ProblemCredentials of a Repositories declared inside a
This cannot be fixed automatically: the repository system session is created before any project is read, and profile activation is resolved later, per project, by the model builder. SolutionA <server> <id>internal</id> <username>u</username> <password>p</password> <repositoryOrigins> <repositoryOrigin>https://repo.example.org</repositoryOrigin> <repositoryOrigin>https://mirror.example.org:8443</repositoryOrigin> </repositoryOrigins> </server>
Differences from #13268
🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…ins its credentials may be used with
Server credentials are scoped to the origin (scheme, host and port) of the
repositories and mirrors declared with the same server id. Repositories
declared inside a settings profile only reach that set when the profile id is
listed in <activeProfiles>; a profile activated through <activation> or -P
contributes no origin, so its credentials are warned about under the default
origin scope and refused under strict, with nothing the operator can do about
it. The session is built before any project exists, so profile activation
cannot be evaluated there.
A <server> can now declare those origins explicitly:
<server>
<id>internal</id>
<username>u</username>
<password>p</password>
<repositoryOrigins>
<repositoryOrigin>https://repo.example.org>
<repositoryOrigin>https://mirror.example.org:8443>
</repositoryOrigins>
</server>
The declared origins are added to the ones Maven derives on its own; nothing
is replaced. Values are bare origins, not repository URLs, and are validated:
a value no origin can be derived from is an error, while a full repository URL
is accepted with a warning naming the origin actually used. Values with a
property placeholder are skipped, as validation runs before interpolation.
The warnings of the origin binding now name <repositoryOrigins> as the way to
declare a missing origin.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
cstamas
approved these changes
gnodet-bot
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solid backport of #13268 to
No issues found. This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
generalmimon
added a commit
to kaitai-io/kaitai_struct_java_runtime
that referenced
this pull request
GitHub Actions' hosted Ubuntu 24.04 runners [now ship Maven 3.10](https://github.com/actions/runner-images/blob/7e7dc1bcc0ef464e5e315a2b4c33609590c6cffe/images/ubuntu/Ubuntu2404-Readme.md#project-management), which [offers the credentials of a `<server>` in `settings.xml` only to the repository origins associated with its id](https://maven.apache.org/docs/3.10.0/release-notes.html#Repository_credentials_are_scoped) (an origin is a scheme, host and port). The setup-java action generates this `settings.xml` from its `server-id` input. The id `central` is also the id of Maven's built-in Central repository (https://repo.maven.apache.org, where dependencies are downloaded from), so Maven did not send our Central Portal user token (the `CENTRAL_SONATYPE_*` secrets) to the Sonatype Central Portal (https://central.sonatype.com), where we publish, and the snapshot deploy in CI failed: ``` [WARNING] Not using credentials of server 'central' for repository https://central.sonatype.com/repository/maven-snapshots/: the origins declared for this id are [https://repo.maven.apache.org]. Add 'https://central.sonatype.com' to <repositoryOrigins> of that server in settings if these credentials belong there, or set maven.repository.credentialScope=id to restore legacy id-only credential matching. [ERROR] Failed to execute goal org.sonatype.central:central-publishing-maven-plugin:0.8.0:publish (injected-central-publishing) on project kaitai-struct-runtime: Failed to deploy artifacts: Could not transfer artifact io.kaitai:kaitai-struct-runtime:jar:0.12-20261015.145648-9 from/to central (https://central.sonatype.com/repository/maven-snapshots/): HTTP Status: 401 -> [Help 1] ``` actions/setup-java#1284 describes the same failure. Unlike `central`, the new id `sonatype-central` is not the id of any repository, so Maven ties no origin to it and uses its credentials for the Central Portal. [According to Maven's source](https://github.com/apache/maven/blob/c43a36b8d67be7e0805a411bc0898af1a51f5472/maven-core/src/main/java/org/apache/maven/internal/aether/OriginBoundAuthenticationSelector.java#L159-L169), Maven should then log a different, non-blocking warning instead of the one above: "Using credentials of server 'sonatype-central' ... although no repository or mirror with this id is declared ... and the server declares no `<repositoryOrigins>`". Two alternatives were rejected: - Adding https://central.sonatype.com to the `<repositoryOrigins>` of the `central` server: [declared origins are added to the discovered ones](apache/maven#13275), so Maven would still offer the token to repo.maven.apache.org (which never needs it), as Maven 3.9 did by matching credentials by id alone. - Restoring the id-only matching with `-Dmaven.repository.credentialScope=id`: it would turn off the new origin scoping entirely. The new warning can be silenced by declaring the origin as `sonatype-central:https://central.sonatype.com` in the `mvn-server-repository-origins` input of [setup-java v6.1.0](https://github.com/actions/setup-java/releases/tag/v6.1.0); this repository still uses setup-java v5.6.0, which lacks that input. Release deploys will also need central-publishing-maven-plugin 0.12.0 or newer, the first version that [supports Maven 3.10](https://github.com/sonatype-nexus-community/central-publishing-maven-plugin/blob/15c4bb23cb74f6f65357037278712c9c4620ab25/README.md#compatibility). Older versions leave the extra files that Maven 3.10 writes into the staging directory (`maven-metadata-local.xml`, `_remote.repositories`) in the release bundle, [which Central rejects](https://central.sonatype.org/publish/publish-portal-maven/#0120-13-oct-2026) (sonatype-nexus-community/central-publishing-maven-plugin#1). This repository still uses 0.8.0. Co-authored-by: Claude Opus 5.5 <[email protected]>
Stephan202
added a commit
to PicnicSupermarket/error-prone-support
that referenced
this pull request
Maven 3.10 binds server credentials to the origin of the repositories that are declared using the same ID. This breaks two cases: - The `central` credentials are used to deploy snapshots to `central.sonatype.com`, but are bound to `repo.maven.apache.org`. The credentials would thus no longer be sent when deploying. - The `error-prone-fork` repository is declared in a profile that is activated using `-P`, so its origin is unknown when Maven starts. Declare the origins explicitly to silence the associated warnings and to keep the deployment working. See: - apache/maven#13275
ibauersachs
added a commit
to dnsjava/dnsjava
that referenced
this pull request
slachiewicz
approved these changes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers+1 more reviewerUh oh!
There was an error while loading. Please reload this page. AssigneesLabels
bug
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Sort out credentials scope handlingUh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |