maven - 分析依赖作为pom的依赖
问题描述
假设我们创建了一个项目,它是一种库项目(项目聚合依赖项)。
<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>
另一个项目正在使用库项目作为依赖项。
<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>
我认为这个用例假设my-axis2-client使用 axis2-client 中的依赖项作为直接依赖项。所以这意味着我可以在 my-axis2-client 中使用 org.apache.axis2.client.ServiceClient(in axis2-kernel-1.6.2.jar) 类。但是,当我运行时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
我不认为这是一个有效的警告。请让我知道是否有任何方法可以分析这种情况下的依赖关系。
解决方案
在您的构造中,生成的依赖项是传递的,而不是直接的。你依赖于一个 POM,它本身依赖于 jars。
推荐阅读
- amazon-web-services - AWS 是否会关闭每个可用区(AZ)或整个区域进行维护
- swift - 如何在我的 iOS 应用程序中集成 Appsee 线框回放?
- haskell - 使用 STM 被“卡住”
- java - 我需要一些关于登录系统的帮助
- macos - tcpdump:过滤器表达式中的语法错误:语法错误
- sql - 如何使用条件从多个地址中选择一个地址
- c++ - 无法在发布模式下构建项目,但在调试模式下构建
- json - 如何修复 Spring Boot 中的“TransientPropertyValueException”错误
- c# - 在 C# 中出队前执行操作
- ios - PromiseKit ios Swift 闭包返回类型问题