You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Joseph Walton (Jira)" <ji...@apache.org> on 2020/04/03 14:02:00 UTC

[jira] [Comment Edited] (MNG-6613) Mirror matching ignores closest/nearest definition

    [ https://issues.apache.org/jira/browse/MNG-6613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17074601#comment-17074601 ] 

Joseph Walton edited comment on MNG-6613 at 4/3/20, 2:01 PM:
-------------------------------------------------------------

This looks like it could be a bug with the test, rather than Maven itself. The existing {{DefaultMirrorSelectorTest}} covers (almost) that case, and passes.

That integration test runs with a user {{settings.xml}} that includes:
{code:java}
        <repository>
          <id>maven-core-it</id>
          ...
        </repository>
...
    <mirror>
      <id>central</id>
      <url>http://maven.apache.org/null</url>
...
      <mirrorOf>*,!maven-core-it</mirrorOf>
    </mirror>
{code}
So that mirror shouldn't be used as a mirror of {{maven-core-its}}. However, the test also includes {{--global-settings}} that include:
{code:java}
        <repository>
          <id>central</id>
          <name>Apache Maven Integration Testing Repository</name>
          <url>file:target/null</url>
...
        </repository>
{code}
That means that there are two repositories ({{central}} and {{maven-core-its}}), and the that mirror *also* with an id of {{central}} is used as a mirror of the {{central}} repository.

As a possible fix, also exclude {{central}} in {{<mirrorOf/>}}:
{code:java}
diff --git a/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml b/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml
index da05129f..346f9fc1 100644
--- a/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml
+++ b/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml
@@ -49,7 +49,7 @@ under the License.
       The explicit mismatch with maven-core-it should be dominant over the wildcard, even if the wildcard
       is given first.
       -->
-      <mirrorOf>*,!maven-core-it</mirrorOf>
+      <mirrorOf>*,!maven-core-it,!central</mirrorOf>
     </mirror>
   </mirrors>
 </settings>
{code}
I believe that leaves it as a valid test; [PR opened|https://github.com/apache/maven-integration-testing/pull/57].

As an aside, anyone who has run this test with Internet access will have made repeated requests over a non-secure connection for:
{code:java}
 http://maven.apache.org/null/org/apache/maven/its/mng3461/a/0.1/a-0.1.pom{code}
It would be nice to confirm that these logs aren't retained.

 


was (Author: joe@kafsemo.org):
This looks like it could be a bug with the test, rather than Maven itself. The existing {{DefaultMirrorSelectorTest}} covers (almost) that case, and passes.

That integration test runs with a user {{settings.xml}} that includes:
{code:java}
        <repository>
          <id>maven-core-it</id>
          ...
        </repository>
...
    <mirror>
      <id>central</id>
      <url>http://maven.apache.org/null</url>
...
      <mirrorOf>*,!maven-core-it</mirrorOf>
    </mirror>
{code}
So that mirror shouldn't be used as a mirror of {{maven-core-its}}. However, the test also includes {{--global-settings}} that include:
{code:java}
        <repository>
          <id>central</id>
          <name>Apache Maven Integration Testing Repository</name>
          <url>file:target/null</url>
...
        </repository>
{code}
That means that there are two repositories ({{central}} and {{maven-core-its}}), and the that mirror *also* with an id of {{central}} is used as a mirror of the {{central}} repository.

As a possible fix, also exclude {{central}} in {{<mirrorOf/>}}:
{code:java}
diff --git a/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml b/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml
index da05129f..346f9fc1 100644
--- a/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml
+++ b/core-it-suite/src/test/resources/mng-3461/test-3/settings-template.xml
@@ -49,7 +49,7 @@ under the License.
       The explicit mismatch with maven-core-it should be dominant over the wildcard, even if the wildcard
       is given first.
       -->
-      <mirrorOf>*,!maven-core-it</mirrorOf>
+      <mirrorOf>*,!maven-core-it,!central</mirrorOf>
     </mirror>
   </mirrors>
 </settings>
{code}
I believe that leaves it as a valid test.

As an aside, anyone who has run this test with Internet access will have made repeated requests over a non-secure connection for:
{code:java}
 http://maven.apache.org/null/org/apache/maven/its/mng3461/a/0.1/a-0.1.pom{code}
It would be nice to confirm that these logs aren't retained.

 

> Mirror matching ignores closest/nearest definition
> --------------------------------------------------
>
>                 Key: MNG-6613
>                 URL: https://issues.apache.org/jira/browse/MNG-6613
>             Project: Maven
>          Issue Type: Bug
>          Components: Artifacts and Repositories
>    Affects Versions: 3.5.4, 3.6.1
>         Environment: Java 8u202, Java11u2
>            Reporter: Michael Osipov
>            Priority: Critical
>         Attachments: log.txt
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Ran our IT suite in a locked down environment at work, w/o direct internet access. IT {{mng3461MirrorMatching(itNonGreedyWildcard)}} blocks forever because the mirror exclude does not work: {{*,!maven-core-it}}.
> It still tries to download via mirror instead of ignoring it. See attached log file. Even switching {{!maven-core-it,*}} makes no difference.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)