Repository navigation
feat: support Maven server credential origins - #1282
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Origin parsing accepts malformed values and can normalize non-HTTP ports incompatibly with Maven.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds Maven 3.10 repository-origin scoping for generated server credentials.
Changes:
- Adds and validates
mvn-server-repository-origins. - Emits
<repositoryOrigins>in Maven settings. - Updates tests, documentation, and distribution bundles.
| File | Description |
|---|---|
src/constants.ts |
Defines the new input. |
src/auth.ts |
Parses origins and generates XML. |
README.md |
Documents the input. |
docs/advanced-usage.md |
Adds multi-server examples. |
action.yml |
Exposes the action input. |
__tests__/auth.test.ts |
Tests parsing and generation. |
dist/setup/index.js |
Updates the setup bundle. |
dist/setup/81.index.js |
Bundles authentication logic. |
dist/cleanup/index.js |
Updates bundled constants. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let url: URL; | ||
| try { | ||
| url = new URL(value); | ||
| } catch { | ||
| throw new Error( |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Maven 3.10.0 on the runner image offers server credentials only to the origins bound to the server id. The id central is bound to repo.maven.apache.org, so the token is withheld from central.sonatype.com and the snapshot deploy fails with HTTP 401. credentialScope=id restores the id-only matching until setup-java releases mvn-server-repository-origins (actions/setup-java#1282, release asked in actions/setup-java#1284). Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
Maven 3.10.0 on the runner image offers server credentials only to the origins bound to the server id. The id central is bound to repo.maven.apache.org, so the token is withheld from central.sonatype.com and the snapshot deploy fails with HTTP 401. credentialScope=id restores the id-only matching until setup-java releases mvn-server-repository-origins (actions/setup-java#1282, release asked in actions/setup-java#1284). Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
|
I wanted to ask if this one could be released as e.g. 6.0.2 (or 6.1.0)? With the current latest 6.0.1 it seems not possible to avoid a warning about the missing in settings.xml when publishing to Sonatype Central. I have tried to pin setup-java to 2a69be2, and it works like a charm and fixes the warnings, but if possible I would prefer to pin to a version tag. Thank you! |
|
Thank you very much, @YunaBraska and @brunoborges (and the rest!) 🙌 |

Why
Maven 3.10 scopes a
settings.xmlserver credential to repository origins.setup-javacan generate Maven server credentials, but cannot declare the corresponding<repositoryOrigins>. When a publisher resolves a repository dynamically, such as Central Publishing usinghttps://central.sonatype.com, Maven intentionally withholds the configured credential and deployment fails with HTTP 401.This is the behaviour introduced by Maven 3.10: release notes, settings reference, and implementation change.
Consumers currently have to patch the
settings.xmlgenerated by this action after every setup step.What
mvn-server-repository-origins, a multilineserver-id:repository-origininput.<repositoryOrigins>within the matching Maven server.Example:
Verification
npm run check