4 Replies Latest reply on Aug 13, 2012 12:39 PM by Karel Piwko

    shrinkwrap-resolver problems (deployment works with 1.0.0-beta-7, fails with 2.0.0-alpha-1)

    matk Newbie

      Hi

       

      I have a maven multi module project that uses arquillian for the tests.

       

      Project Structure is the following:

       

      • pom-project A
        • jar-project A1
        • war-project A2 (has  a dependency on A1, and a test dependency on a test-jar of A1)
      • jar-project Utility1

       

      All are snapshot projects, and we use shrinkwrap 1.0.0-beta-7 and everything seems works. But because of some strange issues which I was unable to track down yet with jenkins I decided to try to upgrade to 2.0.0-alpha-1 just to see if maybe our jenkins problems have to do with shrinkwrap.

       

      So I upgraded and modified our deployment generating method that is used for alle test cases in A2, basically it looks like this for 1.0.0-beta-7:

       

       

      {code}

      /**

           * @return the deployment.

           */

          @Deployment

          public static Archive<?> createDeployment() {

              LOG.info("Creating Archive");

       

              final MavenDependencyResolver resolver =

                      DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml").goOflline();

       

       

       

              Archive<?> jar = null;

       

              try {

                  jar =

                          ShrinkWrap.create(WebArchive.class, "test.war")

                                    .addPackages(true, Filters.exclude(".*Test.*"), IResponder.class.getPackage())

                                    .addAsLibraries(resolver.artifact("xxx:A1").resolveAsFiles())

                                    .addAsLibraries(resolver.artifact("iaik:jce_full").resolveAsFiles())

                                    .addAsLibraries(resolver.artifact("org.bouncycastle:bcprov-jdk16").resolveAsFiles())

       

                                    .addAsWebInfResource("WEB-INF/test-web.xml", "web.xml")

                                    .addAsWebInfResource(EmptyAsset.INSTANCE, "classes/META-INF/messages.properties")

                                    .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

       

                  LOG.info(jar.toString(true));

              } catch (IllegalArgumentException e) {

                  LOG.fatal(e);

              } catch (ResolutionException e) {

                  LOG.fatal(e);

              }

              return jar;

          }

      {code}

       

      for 2.0.0-alpha-1 I had to only change one line to

       

       

      {code}

      final MavenDependencyResolver resolver =

                      DependencyResolvers.use(MavenDependencyResolver.class).loadEffectivePom("pom.xml").up().goOffline();

      {code}

       

      In 1.0.0-beta-7 the war had the following libraries attached:

       

       

      {quote}

      /WEB-INF/

      /WEB-INF/lib/

      /WEB-INF/lib/bcprov-jdk16-1.45.jar

      /WEB-INF/lib/Utility1-1.0.7-SNAPSHOT.jar

      /WEB-INF/lib/slf4j-api-1.5.6.jar

      /WEB-INF/lib/jcl-over-slf4j-1.5.6.jar

      /WEB-INF/lib/jce_full-4.0.jar

      /WEB-INF/lib/A1-0.1-SNAPSHOT.jar

      /WEB-INF/lib/log4j-over-slf4j-1.5.6.jar

      /WEB-INF/lib/slf4j-jdk14-1.5.6.jar

      /WEB-INF/lib/jboss-logmanager-1.3.1.Final.jar

      /WEB-INF/lib/pojomatic-1.0.jar

      {quote}

       

      with 2.0.0-alpha-1 I get the following content and test cases fails because of a "WELD-001408 Unsatisfied dependencies..." because a Service in A1 is not found.

       

       

      {quote}

      /WEB-INF/

      /WEB-INF/lib/

      /WEB-INF/lib/slf4j-api-1.5.6.jar

      /WEB-INF/lib/A1-8959527972391662377.jar

      /WEB-INF/lib/Utility1-14272324002276223.jar

      /WEB-INF/lib/Utility1-2198082340763956217.jar

      /WEB-INF/lib/A1-1125265025565094116.jar

      /WEB-INF/lib/pojomatic-1.0.jar

      /WEB-INF/lib/jboss-logmanager-1.3.1.Final.jar

      /WEB-INF/lib/slf4j-jdk14-1.5.6.jar

      /WEB-INF/lib/bcprov-jdk16-1.45.jar

      /WEB-INF/lib/A1-5776949679912350732.jar

      /WEB-INF/lib/jcl-over-slf4j-1.5.6.jar

      /WEB-INF/lib/jce_full-4.0.jar

      /WEB-INF/lib/log4j-over-slf4j-1.5.6.jar

      /WEB-INF/lib/Utility1-540100635729770131.jar

      {quote}

       

      I also tried it with a simple pom with just the dependencies because it is quite common in the examples but got the same result.

       

      Anybody got any similar results or sees some problem in the way I build my assembly?