2 Replies Latest reply on Feb 26, 2008 10:03 AM by Paul Gier

    What do the dependency:analyze warnings mean?

    Scott Stark Master

      Running mvn dependency:analyze on https://svn.jboss.org/repos/jbossas/projects/naming/trunk/jnpserver produces:

      [INFO] [dependency:analyze]
      [WARNING] Unused declared dependencies found:
      [WARNING] jboss:jboss-logging-spi:jar:2.0.2.GA:compile
      [WARNING] apache-log4j:log4j:jar:1.2.14:compile
      [WARNING] jboss:jboss-common-core:jar:2.0.2.GA:compile
      [WARNING] jboss:jboss-logging-log4j:jar:2.0.2.GA:runtime
      [WARNING] junit:junit:jar:3.8.1:compile
      


      All of these unused dependencies are in fact used, so what is this telling me?


        • 1. Re: What do the dependency:analyze warnings mean?
          Adrian Brock Master

           

          "scott.stark@jboss.org" wrote:

          All of these unused dependencies are in fact used, so what is this telling me?


          Probably that is using a transitive dependency from one of the other
          dependencies instead of the what you declared.

          The MC build has lots of this kind of thing which solves the problem,
          but it isn't the real solution for me:

          
          <!-- I want JBossXB -->
          
           <dependency>
           <groupId>org.jboss</groupId>
           <artifactId>jbossxb</artifactId>
          
          <!-- But don't let it override what I say the versions should be! :-( -->
          
           <exclusions>
           <exclusion>
           <groupId>jboss</groupId>
           <artifactId>jboss-common-core</artifactId>
           </exclusion>
           <exclusion>
           <groupId>jboss</groupId>
           <artifactId>jboss-common-logging-spi</artifactId>
           </exclusion>
           </exclusions>
           </dependency>
          


          • 2. Re: What do the dependency:analyze warnings mean?
            Paul Gier Master

             

            "scott.stark@jboss.org" wrote:

            All of these unused dependencies are in fact used, so what is this telling me?


            The reason these ones are showing up is because of the renamed stuff. When the groupId changes from one version to another, then maven doesn't know that they are the same thing anymore. So the code might be compiling against a version picked up transitively. The way around this is to exclude the transitive dependency. Unfortunately there is currently no way to globally exclude a certain transitive dep. So you have to exclude it from each direct dependency where it is picked up.

            The junit dependency could probably be changed to a test scope instead of compile scope since it's not used by the main classes. I think that's why it's complaining about that one.