简体   繁体   English

将依赖的依赖分析为 pom

[英]Analyzing dependency of dependency as a pom

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.我认为这个用例假设my-axis2-client使用axis2-client 中的依赖作为直接依赖项。 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.所以这意味着我可以在 my-axis2-client 中使用 org.apache.axis2.client.ServiceClient(inaxis2-kernel-1.6.2.jar) 类。 However, when I run mvn dependency:anlyze , it generates the following result.但是,当我运行mvn dependency:anlyze ,它会生成以下结果。


    [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.请让我知道是否有任何方法可以分析这种情况下的依赖关系。

In your construction, the resulting dependencies are transitive , not direct.在您的构建中,产生的依赖项是可传递的,而不是直接的。 You depend on a POM, which itself depends on the jars.您依赖于 POM,而 POM 本身取决于罐子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM