ops4j / org.ops4j.pax.url

Custom URL stream handlers for OSGi
http://team.ops4j.org/wiki/display/paxurl
Other
25 stars 57 forks source link

The use of <mirrorOf>*</mirrorOf> in maven's settings.xml is ignored by aether. [PAXURL-288] #318

Closed ops4j-issues closed 10 months ago

ops4j-issues commented 9 years ago

Jonathan Fortin created PAXURL-288

The use of <mirrorOf>*</mirrorOf> statement in the maven's settings.xml configuration file is ignored causing dependencies to not be downloaded.

We are running pax-exam tests with a karaf container. Dependencies resolved at run time to be downloaded by the aether resolver fail.

 2014-10-21 10:11:38,728 | WARN  | FelixStartLevel  | AetherBasedResolver              | 1 - org.ops4j.pax.url.mvn - 2.2.0 | Error resolving artifactorg.ops4j.pax.exam:pax-exam-features:xml:3.5.0:Could
 not find artifact org.ops4j.pax.exam:pax-exam-features:xml:3.5.0
shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.ops4j.pax.exam:pax-exam-features:xml:3.5.0
        at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
        at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
        at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
        at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:344)
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolveFile(AetherBasedResolver.java:313)
        at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:297)
        at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:131)
        at org.apache.karaf.features.internal.FeatureValidationUtil.load(FeatureValidationUtil.java:93)
        at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:58)
        at org.apache.karaf.features.internal.FeaturesServiceImpl.validateRepository(FeaturesServiceImpl.java:162)
        at org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:233)
        at org.apache.karaf.features.internal.FeaturesServiceImpl.initState(FeaturesServiceImpl.java:844)
        at org.apache.karaf.features.internal.FeaturesServiceImpl.start(FeaturesServiceImpl.java:856)

Affects: 2.2.0 Votes: 1, Watches: 3

ops4j-issues commented 9 years ago

Achim Nierbeck commented

are you sure this is not a regression from PAXURL-286 ?

ops4j-issues commented 9 years ago

Jonathan Fortin commented

Yes I am. I don't have any space in my user's folder and I see the mirror configuration getting loaded by the MavenSettingBuilder org.ops4j.pax.url.mvn.internal.config.MavenConfigurationImpl at line #550.

ops4j-issues commented 9 years ago

Achim Nierbeck commented

Added a new test where just a

<mirrorOf>*</mirrorOf>

is contained. Works without issue, so must be related to something else.

ops4j-issues commented 9 years ago

Achim Nierbeck commented

added tests:
https://github.com/ops4j/org.ops4j.pax.url/commit/b9ee83d3d03b8b10c9e50bea3c875089e8aa3984

ops4j-issues commented 9 years ago

Jonathan Fortin commented

Thank you Achim for look into this bug. I posted the bug here thinking it was aether but I might have not provided enough information. The mirrorOf element in my configuration file is retrieved from my settings by the MavenSettingsBuilder. The problem arise when pax-exam ask aether to resolve an external dependency. The call is never routed to my mirrorOf server but it is directly routed to the fallback server (https://github.com/ops4j/org.ops4j.pax.url/blob/eef0c9142aa0b9e1f59182c46f4320664faeefa9/pax-url-aether/src/main/java/org/ops4j/pax/url/mvn/internal/config/MavenConfigurationImpl.java#L562). I guess it's pretty hard to get a good test running for this bug unless you check the ip of the endpoint and compare it with the ip in the settings.xml. I'm not familliar enough with this project yet to identify the root of the problem.

grgrzybek commented 10 months ago

Works already, but I also reviewed it when upgrading Maven Resolver with #417