Skip to content

Support Maven mirrors in generated settings.xml - #1288

Closed
brunoborges wants to merge 1 commit into
actions:mainfrom
brunoborges:brunoborges-support-maven-mirrors-in-generated-setti
Closed

brunoborges wants to merge 1 commit into
actions:mainfrom
brunoborges:brunoborges-support-maven-mirrors-in-generated-setti

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
Add optional mvn-mirrors input with multiline mirror-id:mirror-url:mirror-of entries and generate top-level Maven <mirrors> settings independently of repository profiles.

Preserve URL schemes/ports and selectors such as external:* and external:http:*; reject missing fields and duplicate IDs; escape generated XML. Authenticated mirrors use matching server IDs, while public mirrors need no matching credentials. Existing repository/Central controls, GPG settings, custom paths, and overwrite behavior remain unchanged.

Includes documentation, regression tests, cross-platform Maven mirror-selection workflow coverage, and rebuilt action bundles.

Validation:

  • npm run check — passed: formatting, lint, build, and all 45 test suites / 1,585 tests.
  • npx tsc --noEmit — passed.
  • New PowerShell workflow assertions executed locally against Maven 3.9.15 for * and external:* — passed, confirming Central and POM-declared dependency/plugin repository redirection. GitHub-hosted Windows/Linux jobs have not been run locally.

Related issue:
Fixes #1287

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 59df028a-0d1b-49cb-8126-ab26408663e4
Copilot AI balanced review requested due to automatic review settings October 16, 2026 13:40
@brunoborges
brunoborges requested a review from a team as a code owner October 16, 2026 13:40
@brunoborges brunoborges reopened this Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No blocking issues remain in input handling, settings generation, compatibility, or coverage.

0 open findings

What changed in this PR

Adds mvn-mirrors support to generated Maven settings, addressing #1287 by redirecting repositories independently of repository profiles.

Changes:

  • Parses mirror entries, validates required fields and unique IDs, and escapes generated XML.
  • Documents public and authenticated mirrors.
  • Adds regression tests, cross-platform workflow coverage, and rebuilt bundles.
File Description
src/​constants.ts Defines the mirror input constant.
src/​auth.ts Parses mirrors and generates settings XML.
README.md Introduces the mirror input.
docs/​advanced-usage.md Documents configuration and selector behavior.
dist/​setup/​index.js Bundles the new input constant.
dist/​setup/​81.index.js Bundles mirror parsing and generation.
dist/​cleanup/​index.js Refreshes bundled constants.
action.yml Declares the optional input.
.github/​workflows/​e2e-publishing.yml Checks mirror selection across platforms.
tests/​auth.test.ts Covers parsing, XML, and settings compatibility.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

with:
persist-credentials: false
- name: Configure Maven mirrors without repository inputs
uses: ./

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Missing selectors in port or IPv6 URLs can silently produce ineffective mirrors instead of validation errors.

1 open finding

🧠 Review effort: Balanced

Comment thread src/auth.ts
Comment on lines +360 to +364
const scheme = /^[A-Za-z][A-Za-z0-9+.-]*:/.exec(remainder)?.[0] ?? '';
const fields =
/^(.*?):((?:\s*!?external:(?:http:)?\*\s*|[^:,]*)(?:,(?:\s*!?external:(?:http:)?\*\s*|[^:,]*))*)$/.exec(
remainder.slice(scheme.length)
);
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.

Support Maven mirrors in generated settings.xml

3 participants