[英]Maven dependency tree and pom dependencies
I would like to know all transitive dependencies of the following jar: 我想知道以下jar的所有传递依赖:
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
</dependency>
Moving a classic command to the pom.xml of the project's defining that dependency and inputting: 将经典命令移动到项目的pom.xml,定义该依赖项并输入:
mvn dependency:tree
mvn依赖:树
would show: 会显示:
+- org.codehaus.mojo:xmlbeans-maven-plugin:jar:2.3.3:compile
| +- xml-resolver:xml-resolver:jar:1.2:compile
| +- org.apache.maven:maven-model:jar:2.0.6:compile
| +- org.apache.maven:maven-artifact:jar:2.0.6:compile
| +- org.apache.maven:maven-project:jar:2.0.6:compile
| | +- org.apache.maven:maven-settings:jar:2.0.6:compile
| | +- org.apache.maven:maven-profile:jar:2.0.6:compile
| | +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
| | | +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
| | | \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
| | +- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
| | \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
| | +- junit:junit:jar:3.8.1:compile
| | \- classworlds:classworlds:jar:1.1-alpha-2:compile
| +- org.apache.maven:maven-plugin-api:jar:2.0.6:compile
| +- org.apache.xmlbeans:xmlbeans:jar:2.4.0:compile
| | \- stax:stax-api:jar:1.0.1:compile
| \- org.codehaus.plexus:plexus-utils:jar:1.5.6:compile
I don't see the mojo-parent: 我没有看到mojo-parent:
<groupId>org.codehaus.mojo</groupId>
<artifactId>mojo-parent</artifactId>
<version>21</version>
<packaging>pom</packaging>
At first glance it seems that the mvn command can show the dependencies which are not pom type. 乍一看似乎mvn命令可以显示不是pom类型的依赖项。
Is there a way to show exactly every single file needed to keep a jar alive? 有没有办法显示保持jar活着所需的每个文件?
Thanks! 谢谢!
Actually it's hard to show files needed to 'keep a jar alive'. 实际上很难显示“保持罐子活着”所需的文件。 Your project can have some implicit dependencies.
您的项目可能有一些隐式依赖项。
You can run mvn dependency:analyze
, it should show you unused dependencies. 您可以运行
mvn dependency:analyze
,它应该显示未使用的依赖项。 But you have realize which of them you can freely remove. 但是你已经意识到你可以自由删除哪些。 http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html
http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html
I can also recommend if you don't want any surprises with transitive dependencies - use maven enforcer. 如果你不希望任何有传递依赖的意外,我也可以推荐 - 使用maven enforcer。 You can ban all undeclared transitive dependencies.
您可以禁止所有未声明的传递依赖项。 http://maven.apache.org/enforcer/enforcer-rules/banTransitiveDependencies.html
http://maven.apache.org/enforcer/enforcer-rules/banTransitiveDependencies.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.