2 Replies Latest reply on Jul 19, 2018 3:58 AM by vmassol

    Different behavior observed between Shrinkwrap Resolver and Maven

    vmassol

      Hi guys,

       

      Thanks for Shrinkwrap it's a very nice and useful lib. I'm trying to use it on the XWiki project.

       

      However I've noticed a difference in the resolved artifacts. I have the following code:

       

      List<MavenResolvedArtifact> artifacts = resolveArtifactWithDependencies(

        String.format("org.xwiki.platform:xwiki-platform-distribution-war-dependencies:pom:%s", version));

       

      protected List<MavenResolvedArtifact> resolveArtifactWithDependencies(String gav)

      {

         return getConfigurableMavenResolverSystem()

             .resolve(gav)

             .withTransitivity()

             .asList(MavenResolvedArtifact.class);

      }

       

      protected ConfigurableMavenResolverSystem getConfigurableMavenResolverSystem()

      {

         return Maven.configureResolver()

             .withClassPathResolution(true)

             .withRemoteRepo(

                   "mavenXWikiSnapshot", "http://nexus.xwiki.org/nexus/content/groups/public-snapshots", "default")

             .withRemoteRepo(

                   "mavenXWiki", "http://nexus.xwiki.org/nexus/content/groups/public", "default");

      }

       

      When this is executes and when I check the resolved artifacts, I can find, for example, "commons-beanutils:commons-beanutils:1.7.0" (which is not what I expect). When I execute "mvn dependency:tree" in the "org.xwiki.platform:xwiki-platform-distribution-war-dependencies" module, it resolves to "commons-beanutils:commons-beanutils:jar:1.9.3" which is what I need.

       

      FTR the version of beanutils we need for XWiki is defined in a dependencyManagement section of our top level POM and it's used in 2 dependencies drawing it transitively.

       

      Is there a way to make shrinkwrap behave like Maven does for artifact resolution? Any idea of what I could do?

       

      Thanks a lot

      -Vincent