Skip to content

Conversation

@yeikel
Copy link

@yeikel yeikel commented Jan 28, 2026

Summary

This PR adds support for using the central mirror defined in settings.xml when resolving Maven Wrapper distribution downloads.

Today, the wrapper plugin only applies a configured mirror if it is defined as *. This change allows the wrapper to work correctly in those environments by honoring the central mirror as well.

What changed

  • The wrapper now detects and applies a mirror configured for central in settings.xml
  • If both * and central mirrors are present, the existing * behaviour remains supported

Fixes #396

  • Your pull request should address just one issue, without pulling in other changes.

  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.

  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.

  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.

  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.

  • You have run the integration tests successfully (mvn -Prun-its verify).

  • I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004

  • In any other case, please file an Apache Individual Contributor License Agreement.

@yeikel yeikel force-pushed the central branch 2 times, most recently from 983e02d to 17e7275 Compare January 28, 2026 04:45
Copy link

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

It looks sane to me and like something that can help users.
Even though central is not strictly "in maven" it is on the super-pom / settings. Even if that (unlikely) ever changes having this now do not harms.

Adds support for using the `central` mirror defined in `settings.xml` when resolving Maven Wrapper distribution downloads.
@yeikel
Copy link
Author

yeikel commented Jan 30, 2026

It looks sane to me and like something that can help users. Even though central is not strictly "in maven" it is on the super-pom / settings. Even if that (unlikely) ever changes having this now do not harms.

Thanks for the feedback. Unfortunately, I had some linting issues that I had to push back, hopefully CI passes now

Copy link
Member

@cstamas cstamas left a comment

Choose a reason for hiding this comment

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

Not enough

@cstamas
Copy link
Member

cstamas commented Jan 30, 2026

Check this page "Advanced Mirror Specification" section:
https://maven.apache.org/guides/mini/guide-mirror-settings.html

MirrorOf possible values:

  • * - matches central
  • external:* - matches central
  • external:http:* - matches central
  • myrepo,central,otherrepo - matches central
  • myrepo,!central,otherrepo - does NOT matches central

@laeubi
Copy link

laeubi commented Jan 31, 2026

@cstamas I think it is to much to ask to support the full range I think, of course if there are demands people can extend this more and more... so why not starting small here?

@cstamas
Copy link
Member

cstamas commented Jan 31, 2026

My stance is that code is done wrongly. It is not (raw) settings that needs to be used, and hence, have replicate/redo all the logic. Instead, code needs to use different APIs. Will craft a PR once there.

@cstamas
Copy link
Member

cstamas commented Jan 31, 2026

Proposed alt (and complete) solution in #399

@yeikel
Copy link
Author

yeikel commented Jan 31, 2026

Closing in favor of #399 as the solution seems better and solves the same problem

@yeikel yeikel closed this Jan 31, 2026
@yeikel yeikel deleted the central branch January 31, 2026 18:50
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.

Add support for the central mirror

3 participants