4 Replies Latest reply on Aug 29, 2007 11:17 AM by pgier

    Maven dependencies still not working properly.

      In the common project there is a jbossxb-builder project
      http://anonsvn.jboss.org/repos/common/jbossxb-builder/trunk/

      This specifies EXPLICITLY a dependency on jbossxb-2.0-snapshot,
      but it is actually picking up jbossxb-2.0.0CR3 via dependency on jboss-container

      [DEBUG] Output directory: /home/ejort/common/jbossxb-builder/target/classes
      [DEBUG] Classpath:
      [DEBUG] /home/ejort/common/jbossxb-builder/target/classes
      [DEBUG] /home/ejort/.m2/repository/jboss/jboss-vfs/2.0.4.snapshot/jboss-vfs-2.0.4.snapshot.jar
      
      WRONG
      
      [DEBUG] /home/ejort/.m2/repository/jboss/jbossxb/2.0.0.CR3/jbossxb-2.0.0.CR3.jar
      [DEBUG] /home/ejort/.m2/repository/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar
      [DEBUG] /home/ejort/.m2/repository/sun-jaxb/jaxb-api/2.0.5/jaxb-api-2.0.5.jar
      [DEBUG] /home/ejort/.m2/repository/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar
      [DEBUG] /home/ejort/.m2/repository/apache-slide/webdavlib/2.0/webdavlib-2.0.jar
      
      CORRECT BUT NOT USED
      
      [DEBUG] /home/ejort/.m2/repository/org/jboss/jbossxb/2.0.0-SNAPSHOT/jbossxb-2.0.0-SNAPSHOT.jar
      


      This is causing it to fail to compile.

      How do we fix this so it is not stupid?

        • 1. Re: Maven dependencies still not working properly.
          pgier

          For some reason, transitive deps show up in the classpath before direct dependencies, so you get issues like this. It's something I will eventually try to fix in maven, because I think direct deps should come first.

          For now, you can exclude the transitive dep on jbossxb by adding this to the container dependency.

           <dependency>
           <groupId>org.jboss.microcontainer</groupId>
           <artifactId>jboss-container</artifactId>
           <version>2.0.0-SNAPSHOT</version>
           <scope>compile</scope>
           <exclusions>
           <exclusion>
           <groupId>jboss</groupId>
           <artifactId>jbossxb</artifactId>
           </exclusion>
           </exclusions>
           </dependency>
          


          • 2. Re: Maven dependencies still not working properly.

            Thanks that worked. I put a FIXME in the pom.

            • 3. Re: Maven dependencies still not working properly.

              This doesn't appear to be a generic fix.
              e.g. see this related problem
              http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079196#4079196
              where Ales and I are getting different build dependencies.

              • 4. Re: Maven dependencies still not working properly.
                pgier

                I changed the container pom to exclude it's transitive dependency (through jbossxb) on jboss-common-core. This seems to give the correct dependencies at compile time.

                To find this, I used "mvn project-info-reports:dependencies" which creates an html page that shows the dependency tree.

                I also used "mvn dependency:analyze" which currently gives me these warnings:


                [INFO] Used declared dependencies:
                [INFO] jboss:jbossxb:jar:2.0.0.CR3:compile
                [INFO] junit:junit:jar:3.8.1:test
                [INFO] jboss.profiler.jvmti:jboss-profiler-jvmti:jar:1.0.0.CR5:test
                [INFO] org.jboss:jboss-common-core:jar:2.2.1-20070828.111252-2:compile
                [INFO] org.jboss:jboss-test:jar:1.0.4-SNAPSHOT:test
                [INFO] org.jboss:javassist:jar:3.6-beta:compile
                [INFO] Used undeclared dependencies:
                [WARNING] jboss:jboss-common-core:jar:2.0.4.GA:test
                [WARNING] jboss:jboss-common-logging-spi:jar:2.0.4.GA:compile
                [WARNING] apache-xerces:xml-apis:jar:2.7.1:compile
                [INFO] Unused declared dependencies:
                [INFO] jboss:jboss-vfs:jar:2.0.4.snapshot:compile
                [INFO] jboss:jboss-logging-spi:jar:2.0.3.GA:compile
                [WARNING] Potential problems discovered.
                [INFO] Found Resolved Dependency / DependencyManagement mismatches:
                [INFO] Ignoring Direct Dependencies.
                [INFO] jboss:jboss-common-core:jar was excluded in DepMgt, but version 2.0.4.GA has been found in the dependency tree.
                [WARNING] Potential problems found in Dependency Management


                I'm going to update the dependencies in container to clean up these warnings.