4 Replies Latest reply on Aug 27, 2012 8:25 AM by schos3

    MavenDependencyResolver question

    viniciuscarvalho

      Hi, I'm trying to get the MavenDependencyResolver to work on my project (I'm using arquillina 1.0.0.Alpha5)

       

          

      WebArchive war = ShrinkWrap.create(WebArchive.class,"pigs.war").addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class).loadDependenciesFromPom("./pom.xml").resolveAs(WebArchive.class));
      

       

      What happens is that It can't download dependencies. At first I thought would be some network issue, but after testing network was ok.

       

      So I checked the LogTransferListerer (some typo here huh )

       

      And it seems that the resolver tries to download one of my local artificats metadata from maven central:

       

      http://repo1.maven.org/maven2/com/acme/service-bus/0.0.1-SNAPSHOT/maven-metadata.xml <> C:\Users\evincar\.m2\repository\com\acme\service-bus\0.0.1-SNAPSHOT\maven-metadata-central.xml

       

      Any ideas?

       

      Regards

        • 1. Re: MavenDependencyResolver question
          elfuhrer

          Where did you get the MavenDependencyResolover class from? Are you sure the loadDependencies implementation is correct?

          • 2. Re: MavenDependencyResolver question
            kpiwko

            Hi Vinicius,

             

            when you're loading pom.xml file, the effective pom file is constructed. This means that if you project has a multimodule structure, where one module depends on other, it must be installed into local repository before Maven resolution can be applied.

             

            This is default behavior of Maven as well. Try to execute (in the directory where pom.xml resides)

             

            mvn dependency:tree
            

             

            and it will fail unable to locate com.acme:service-bus artifact as well.

             

            If by any chance com:acme:service-bus is a parent artifact, you can overcome the need of installing by correctly specifying <relativePath> element in <parent> declaration.

             

            Can you include pom.xml file to verify this is you case?

             

            Karel

             

            PS: Thanks for the typo

            1 of 1 people found this helpful
            • 3. Re: MavenDependencyResolver question
              viniciuscarvalho

              Hi Karel, thanks for the support.

               

              I'm not a maven person, in fact I believe it's the root of all evil in universe, but let's move on ...

               

              It is a multi module project. But I have it installed on my local repo. The parent pom and all the modules as well.

               

              I'm currently changing the layout of my project. I was putting the tests inside the artifact, but due the number of dependencies, I'm moving the tests to some other projects.

               

              Here's our current structure:

               

              service-bus (parent)

              - service-bus-api

              - service-bus-impl

              - service-bus-camel

              - service-bus-jgroups

               

               

              I was putting the arquillian tests inside one of the implemetnations (service-bus-jgroups). I'll now create a separate project called service-bus-jgroups-test and add all tests there, and depend on the api/impl artifacts. I hope this alliviates the problem

               

              I'll keep updating the post so others could use as reference.

               

              Thanks a lot for the help.

              • 4. Re: MavenDependencyResolver question
                schos3

                If i were you i woul update to the new 1.0.1.Final Version of arquillian. there are nmany bugs fixed

                 

                Sven