2 Replies Latest reply on Nov 5, 2018 2:42 AM by ochaloup

    Resolving artifact only from the local repository

    ochaloup

      Hi,

       

      I wonder if there is a way to say to ShrinkWrap to resolve an artifact only from local repository?

       

      I have this code

       

      File[] libs = Maven.resolver()
      .loadPomFromFile("pom.xml")
      .resolve("org.jboss.narayana.rts:lra-annotations")
      .withTransitivity().as(File.class);
      

       

      then the ShrikWrap resolution takes time. I know the artifact is in my local repo and I would like to advice to ShrikWrap to check only the local repo and fails if there is no such artifact. I know if there isn't, there is a trouble with my tests.

      Currently the resolution log looks[1] where places on different repositories are checked, spending time checking them.

       

      Thanks

      Ondra

       

      [1]

      Nov 23, 2017 10:39:19 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-annotations/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://repo1.maven.org/maven2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-annotations:5.7.2.Final-SNAPSHOT/maven-metadata.xml in central (http://repo1.maven.org/maven2)

      Nov 23, 2017 10:39:20 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-annotations/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-annotations:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jbossThirdParty (https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/)

      Nov 23, 2017 10:39:20 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-annotations/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/groups/public/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-annotations:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/)

      Nov 23, 2017 10:39:21 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-annotations/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://download.java.net/maven/2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-annotations:5.7.2.Final-SNAPSHOT/maven-metadata.xml in download-java-net (http://download.java.net/maven/2/)

      Nov 23, 2017 10:39:21 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-parent/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://repo1.maven.org/maven2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-parent:5.7.2.Final-SNAPSHOT/maven-metadata.xml in central (http://repo1.maven.org/maven2)

      Nov 23, 2017 10:39:22 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-parent/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-parent:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jbossThirdParty (https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/)

      Nov 23, 2017 10:39:22 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-parent/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/groups/public/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-parent:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/)

      Nov 23, 2017 10:39:24 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/lra-parent/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://download.java.net/maven/2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:lra-parent:5.7.2.Final-SNAPSHOT/maven-metadata.xml in download-java-net (http://download.java.net/maven/2/)

      Nov 23, 2017 10:39:24 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/rest-tx/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://repo1.maven.org/maven2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:rest-tx:5.7.2.Final-SNAPSHOT/maven-metadata.xml in central (http://repo1.maven.org/maven2)

      Nov 23, 2017 10:39:24 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/rest-tx/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:rest-tx:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jbossThirdParty (https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/)

      Nov 23, 2017 10:39:24 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/rest-tx/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/groups/public/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:rest-tx:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/)

      Nov 23, 2017 10:39:26 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/rts/rest-tx/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://download.java.net/maven/2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana.rts:rest-tx:5.7.2.Final-SNAPSHOT/maven-metadata.xml in download-java-net (http://download.java.net/maven/2/)

      Nov 23, 2017 10:39:26 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/narayana-all/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://repo1.maven.org/maven2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana:narayana-all:5.7.2.Final-SNAPSHOT/maven-metadata.xml in central (http://repo1.maven.org/maven2)

      Nov 23, 2017 10:39:27 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/narayana-all/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana:narayana-all:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jbossThirdParty (https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/)

      Nov 23, 2017 10:39:27 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/narayana-all/5.7.2.Final-SNAPSHOT/maven-metadata.xml from https://repository.jboss.org/nexus/content/groups/public/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana:narayana-all:5.7.2.Final-SNAPSHOT/maven-metadata.xml in jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/)

      Nov 23, 2017 10:39:29 AM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed

      WARNING: Failed downloading org/jboss/narayana/narayana-all/5.7.2.Final-SNAPSHOT/maven-metadata.xml from http://download.java.net/maven/2/. Reason:

      org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.jboss.narayana:narayana-all:5.7.2.Final-SNAPSHOT/maven-metadata.xml in download-java-net (http://download.java.net/maven/2/)

        • 1. Re: Resolving artifact only from the local repository
          rakcheru

          workOffline() Seems to achieve what you are trying to accomplish

           

          Ex:

           

          Maven

          .configureResolver()

          .workOffline()

          .resolve(mavenCoordinate)

          .withoutTransitivity()

          .asSingleFile();

           

          I am using :

           

                     <dependency>

                          <groupId>org.jboss.shrinkwrap.resolver</groupId>

                          <artifactId>shrinkwrap-resolver-api-maven</artifactId>

                          <version>3.1.3</version>

                          <scope>test</scope>

                      </dependency>

          1 of 1 people found this helpful
          • 2. Re: Resolving artifact only from the local repository
            ochaloup

            That sounds promising. Thank you!