Uploaded image for project: 'ShrinkWrap Resolvers'
  1. ShrinkWrap Resolvers
  2. SHRINKRES-227

ShrinkWrap Maven Resolver doesn't support env vars in settings.xml

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • maven
    • None

      I get the stacktrace below when using this code on a jenkins instance that uses env vars in the settings.xml

      return ShrinkWrap.create(WebArchive.class)
                      .addClasses(StringToURL.class, URLToConnection.class, NestingFactoryBean.class, ServiceStringBean.class, ServiceUrlBean.class, ClientProducer.class)
                      .addClasses(DeltaspikeTestBase.getDeltaSpikeHolders())
                      .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
                      .addAsLibraries(Maven.resolver().loadPomFromFile("pom.xml")
                              .resolve(
                                      "org.apache.deltaspike.core:deltaspike-core-impl",
                                      "com.google.mockwebserver:mockwebserver"
                              )
                              .withTransitivity().as(File.class));
      

      Stacktrace..

      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running io.fabric8.cdi.weld.ExtensionTest
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.51 sec <<< FAILURE! - in io.fabric8.cdi.weld.ExtensionTest
      io.fabric8.cdi.weld.ExtensionTest  Time elapsed: 0.51 sec  <<< ERROR!
      java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive io.fabric8.cdi.weld.ExtensionTest.createDeployment()
      	at org.jboss.shrinkwrap.resolver.impl.maven.internal.decrypt.MavenSecurityDispatcher.getMaster(MavenSecurityDispatcher.java:171)
      	at org.jboss.shrinkwrap.resolver.impl.maven.internal.decrypt.MavenSecurityDispatcher.decrypt(MavenSecurityDispatcher.java:96)
      	at org.jboss.shrinkwrap.resolver.impl.maven.internal.decrypt.MavenSettingsDecrypter.decrypt(MavenSettingsDecrypter.java:92)
      	at org.jboss.shrinkwrap.resolver.impl.maven.internal.decrypt.MavenSettingsDecrypter.decrypt(MavenSettingsDecrypter.java:60)
      	at org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenSettingsBuilder.decryptPasswords(MavenSettingsBuilder.java:223)
      	at org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenSettingsBuilder.buildSettings(MavenSettingsBuilder.java:186)
      	at org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenSettingsBuilder.buildDefaultSettings(MavenSettingsBuilder.java:113)
      	at org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionImpl.<init>(MavenWorkingSessionImpl.java:136)
      	at org.jboss.shrinkwrap.resolver.impl.maven.MavenResolverSystemImpl.<init>(MavenResolverSystemImpl.java:44)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      	at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.createInstance(SpiServiceLoader.java:244)
      	at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.createInstances(SpiServiceLoader.java:208)
      	at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.all(SpiServiceLoader.java:79)
      	at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.onlyOne(SpiServiceLoader.java:85)
      	at org.jboss.shrinkwrap.resolver.spi.loader.ServiceRegistry.onlyOne(ServiceRegistry.java:117)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.shrinkwrap.resolver.api.Invokable.invokeMethod(Invokable.java:100)
      	at org.jboss.shrinkwrap.resolver.api.ResolverSystemFactory.createFromUserView(ResolverSystemFactory.java:91)
      	at org.jboss.shrinkwrap.resolver.api.ResolverSystemFactory.createFromUserView(ResolverSystemFactory.java:53)
      	at org.jboss.shrinkwrap.resolver.api.Resolvers.use(Resolvers.java:68)
      	at org.jboss.shrinkwrap.resolver.api.maven.Maven.resolver(Maven.java:36)
      	at io.fabric8.cdi.weld.ExtensionTest.createDeployment(ExtensionTest.java:49)
      

      This error is similar to issue https://issues.jboss.org/browse/SHRINKRES-145 however I cannot escape the values in my settings.xml as they need to resolve to env vars.

      Example snippet of my settings.xml..

      <servers>
        <server>
          <id>local-nexus</id>
          <username>${env.NEXUS_USERNAME}</username>
          <password>${env.NEXUS_PASSWORD}</password>
        </server>
        <server>
          <id>nexus</id>
          <username>${env.NEXUS_USERNAME}</username>
          <password>${env.NEXUS_PASSWORD}</password>
        </server>
        <server>
          <id>docker-registry</id>
          <username>${env.DOCKER_REGISTRY_USERNAME}</username>
          <password>${env.DOCKER_REGISTRY_PASSWORD}</password>
        </server>
      </servers>
      

              Unassigned Unassigned
              jamesrawlings_jira James Rawlings (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: