Relevant MNG Issues

Proposal

Updated Proposal:

 Allow more flexibility in mirror specifications. Currently only a repo Id or * can be used in the mirrorOf field. This isn't very flexible with advanced repo managers and can cause problems with ITs or Units that expect to have specific repos that may have been overridden by the *.

Proposed Changes:

Add new "external:*" syntax to mean any repo except those using localhost, 127.0.0.1 or file://. This is specifically intended to avoid conflicts with units and ITs.

Additionally, allow the mirrorOf to support a list of repoIds and exclusions to the two wildcards (* and external:*). The syntax will be a comma separated list of repoIds to match, and ! meaning not the repo. This provides valid syntaxes such as:

* = everything
external:* = everything not on the localhost and not file based.
repo,repo1 = repo or repo1
*,!repo1 = everything except repo1

and combinations thereof. The order is not important from left to right as the wildcards defer to further processing and explicit includes or excludes stop the processing. Additionally, the mirror list will now be ordered using a LinkedHashMap instead of HashMap such that the user may influence match order by changing the order of the definitions in the settings.xml

  • No labels

6 Comments

  1. Brian, I know you mentioned also exempting URLs with http://localhost in them, and I'd personally prefer to exempt anything with localhost in the URL's host section.

    As we were talking about, it would be nice to have a specific syntax to say, "Any repository that doesn't reside on this machine." Of course, file shares and UNC paths bring up an interesting problem when dealing with the file:// protocol, which is why I didn't allow access to file:// remote repositories when I originally wrote the offline code. Not sure how to solve that one.

    It would be nice to have a keyword syntax like 'external:*' to describe these non-local-machine repositories.

  2. I'll refactor this to be better able to handle some syntax. For example, support comma separated lists and possibly -[repo] to exclude from the wildcard.

  3. If we are reviewing the mirrorOf meaning and syntax, can we also talk about mirroring based on something other than repository id? say the host or url too?

    Posting details into dev@maven soon.

  4. localhost, 127.*, users own machine hostname, entries present in /etc/hosts that point to localhost, are all potential candidates.

    Would having another flag entirely within the <mirror> section indicating "local" be appropriate?

    Say ...

    <mirror>
    <mirrorOf>*</mirrorOf>
    <url>file:///home/repos/central</url>
    <scope>local</scope>
    </mirror>

    Also, I thought UNC paths with the file:// protocol didn't work. Reason I say that is because I've seen cifs:// and unc:// wagon protocol implementations at various businesses to address the file:// + unc issues.

  5. Unknown User (davidfield)

    Quick question: is it correct that currently it is not possible to use the file:// protocol for defining a mirror url in settings.xml. Thanks a lot.