Maven 2 & 3

New mirror syntax is not stopping on first match

Details

  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

The first match of a pattern should be returned, but the last one is being found.

Exact matches should always supercede a pattern.

Issue Links

Activity

Hide
Jason van Zyl added a comment -

Brian, can you take a look because it looks like it's there to me.

Show
Jason van Zyl added a comment - Brian, can you take a look because it looks like it's there to me.
Hide
Benjamin Bentmann added a comment -

The code in DefaultWagonManager from trunk appears to support the extended mirror syntax. For instance, the IT for MNG-3461 checking "external:*" passes with Maven 3.x.

However, according to Brian's proposal and the comments in getMirror(), the first match should win. But the loop is not quit upon a match but continues, potentially choosing a later match. Could that be the cause for Brian's issue?

While we talk about ordering of mirrors, for a settings.xml

<mirrors>
  <mirror>
    <id>test-a</id>
    <url>...</url>
    <mirrorOf>foo</mirrorOf>
  </mirror>
  <mirror>
    <id>test-b</id>
    <url>...</url>
    <mirrorOf>foo</mirrorOf>
  </mirror>
</mirrors>

the mirror "test-b" will be chosen, i.e. the last definition, due later mirrors with equal mirrorOf overriding the former ones. Doesn't feel very consistent with the strategy of first match wins.

Show
Benjamin Bentmann added a comment - The code in DefaultWagonManager from trunk appears to support the extended mirror syntax. For instance, the IT for MNG-3461 checking "external:*" passes with Maven 3.x. However, according to Brian's proposal and the comments in getMirror(), the first match should win. But the loop is not quit upon a match but continues, potentially choosing a later match. Could that be the cause for Brian's issue? While we talk about ordering of mirrors, for a settings.xml
<mirrors>
  <mirror>
    <id>test-a</id>
    <url>...</url>
    <mirrorOf>foo</mirrorOf>
  </mirror>
  <mirror>
    <id>test-b</id>
    <url>...</url>
    <mirrorOf>foo</mirrorOf>
  </mirror>
</mirrors>
the mirror "test-b" will be chosen, i.e. the last definition, due later mirrors with equal mirrorOf overriding the former ones. Doesn't feel very consistent with the strategy of first match wins.
Hide
Brian Fox added a comment -

Issue confirmed with a unit test.

Show
Brian Fox added a comment - Issue confirmed with a unit test.
Hide
Brian Fox added a comment -

This is fixed, just needs an IT

Show
Brian Fox added a comment - This is fixed, just needs an IT
Hide
Benjamin Bentmann added a comment -

IT is up and happy.

Show
Benjamin Bentmann added a comment - IT is up and happy.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: