如果是用命令行,可进入项目所在目录,然后输入: mvn dependency:tree ,来查看jar包依赖关系。
另外还可以在eclipse操作,如下图所示:
点击run后,开始输出JAR包依赖树。
我在执行这步的时候报了下面的异常:
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.graph.DependencyNode
在网上搜了好多地方都没有类似的错误,后来参考了一些帖子,怀疑是maven-dependency-plugin的版本问题,然后就把插件的版本改为2.10了:
修改前:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>.........
修改后:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>.........
然后再次执行上面所说的命令,执行成功:
......
[INFO] +- com.csair:extra-api:jar:1.0.1-20170228:compile
[INFO] +- com.csair.engine.fq:fq-domain:jar:0.7.0-SNAPSHOT:compile
[INFO] | +- org.springframework:spring-context:jar:3.0.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:3.0.7.RELEASE:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:3.0.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-core:jar:3.0.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-expression:jar:3.0.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-asm:jar:3.0.7.RELEASE:compile
[INFO] | +- com.sun.xml.bind:jaxb-facets:jar:0.9.0:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
[INFO] | \- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] +- com.csair.engine.fq:fdc-client:jar:1.1.2:compile
[INFO] | +- com.csair.engine.fq:fdc-domain:jar:1.0.1:compile
[INFO] | | \- com.csair.engine.fq:fq-domain-backport:jar:0.2.1:compile
[INFO] | | \- commons-io:commons-io:jar:2.2:compile
[INFO] | \- org.apache.mina:mina-core:jar:2.0.7:compile
[INFO] +- freemarker:freemarker:jar:2.3.8:compile
[INFO] +- org.apache.velocity:velocity:jar:1.7:compile
[INFO] \- org.apache.velocity:velocity-tools:jar:2.0:compile
[INFO] +- commons-digester:commons-digester:jar:1.8:compile
[INFO] +- commons-chain:commons-chain:jar:1.1:compile
[INFO] +- commons-validator:commons-validator:jar:1.3.1:compile
[INFO] +- oro:oro:jar:2.0.8:compile
[INFO] +- sslext:sslext:jar:1.2-0:compile
[INFO] +- org.apache.struts:struts-core:jar:1.3.8:compile
[INFO] | \- antlr:antlr:jar:2.7.2:compile
[INFO] +- org.apache.struts:struts-taglib:jar:1.3.8:compile
[INFO] \- org.apache.struts:struts-tiles:jar:1.3.8:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
........
其中“+-”符号表示该包后面还有其它依赖包,“\-”表示该包后面不再依赖其它jar包了。
如有错误,欢迎指出交流。