Analyzing dependency of dependency as a pom

Viewed 82

Let’s assume we create a project which is a kind of library project(a project aggregates dependencies).


    <project>
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.packt</groupId>
      <artifactId>axis2-client</artifactId>
      <version>1.0.0</version>
      <packaging>pom</packaging>
      <dependencies>
        <dependency>
          <groupId>org.apache.axis2</groupId>
          <artifactId>axis2-kernel</artifactId>
          <version>1.6.2</version>
        </dependency>
        <dependency>
          <groupId>org.apache.axis2</groupId>
          <artifactId>axis2-adb</artifactId>
          <version>1.6.2</version>
        </dependency>
        <dependency>
          <groupId>org.apache.axis2</groupId>
          <artifactId>axis2-transport-http</artifactId>
          <version>1.6.2</version>
        </dependency>
        <dependency>
          <groupId>org.apache.axis2</groupId>
          <artifactId>axis2-transport-local</artifactId>
          <version>1.6.2</version>
        </dependency>
        <dependency>
          <groupId>org.apache.axis2</groupId>
          <artifactId>axis2-xmlbeans</artifactId>
          <version>1.6.2</version>
        </dependency>
      </dependencies>
    </project>

Another project is using the library project as a dependency.


    <project>
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.packt</groupId>
      <artifactId>my-axis2-client</artifactId>
      <version>1.0.0</version>

      <dependencies>
        <dependency>
          <groupId>com.packt</groupId>
          <artifactId>axis2-client</artifactId>
          <version>1.0.0</version>
          <type>pom<type>
        </dependency>
      </dependencies>
    </project>

I think this use-case assumes that my-axis2-client uses the dependencies in axis2-client as direct dependency. So it means I can use, let’s say, org.apache.axis2.client.ServiceClient(in axis2-kernel-1.6.2.jar) class in my-axis2-client. However, when I run mvn dependency:anlyze, it generates the following result.


    [WARNING] Used undeclared dependencies found:
    [WARNING]     org.apache.axis2:axis2-kernal:jar:1.6.2:compile
    [WARNING] Unused declared dependencies found:
    [WARNING]     compackt:axis2-client:pom:1.0.0:compile

I don’t think this is a valid warning. Please let me know if there is any way to analyze dependencies this case.

1 Answers

In your construction, the resulting dependencies are transitive, not direct. You depend on a POM, which itself depends on the jars.

Related