H5W3
当前位置:H5W3 > 问答 > 正文

【java】maven dependency:tree中的符号啥意思

maven dependency里+- 和-有啥区别。我+-后面的项目坐标,为什么我在pom里找不到。
我没有描述清楚,让人误会了。我是用的 maven dependency:tree 命令。

+- com.ss.ss: xx.jar
+- xxxx: xx.jar
+- xx:xx.jar
\- xx: xx.jar

这种形式。请问这里的+-和-什么区别。

回答

给你参考对比一下就明白了。截图如下:
1.maven项目中pom.xml文件的dependency hierarchy 即依赖的jar包结构图,很显然缩进的jar包是上一行jar包的子包,这些在解决jar包的冲突的时候是非常关键的。
2.第二幅图,是使用命令mvn dependency:tree -Dverbose看到的结构图,跟图1一模一样的,也是反映了jar包之间的等级关系。至于你的命令mvn dependency:tree所展现的层级数,并没有完整的展现所有的传递依赖,加上参数-Dverbose,就可以完整的展现层级依赖关系了。

【java】maven dependency:tree中的符号啥意思

[INFO] ------------------------------------------------------------------------
E:\Eclipse project\first_maven_project>mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building first_maven_project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ first_maven_project ---
[INFO] com.sucre:first_maven_project:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:3.2.8.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.2.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.2.8.RELEASE:compile
[INFO] |  |  \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- org.springframework:spring-expression:jar:3.2.8.RELEASE:compile
[INFO] |  |  \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-web:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-context:jar:3.2.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-aop:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-expression:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-context-support:jar:3.2.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-aop:jar:3.2.8.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-aspects:jar:3.2.8.RELEASE:compile
[INFO] |  \- org.aspectj:aspectjweaver:jar:1.7.4:compile
[INFO] +- org.springframework:spring-tx:jar:3.2.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-jdbc:jar:3.2.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-tx:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-web:jar:3.2.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-aop:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- junit:junit:jar:4.10:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] +- log4j:log4j:jar:1.2.12:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.6:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.6:compile
[INFO] |  +- (org.slf4j:slf4j-api:jar:1.6.6:compile - omitted for duplicate)
[INFO] |  \- (log4j:log4j:jar:1.2.17:compile - omitted for conflict with 1.2.12)
[INFO] +- org.springframework:spring-test:jar:3.2.8.RELEASE:test
[INFO] |  \- (org.springframework:spring-core:jar:3.2.8.RELEASE:test - omitted for duplicate)
[INFO] +- org.mybatis:mybatis:jar:3.2.1:compile
[INFO] +- org.mybatis:mybatis-spring:jar:1.2.0:compile
[INFO] \- mysql:mysql-connector-java:jar:5.1.29:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.589 s
[INFO] Finished at: 2016-07-07T08:03:13+08:00
[INFO] Final Memory: 9M/22M
[INFO] ------------------------------------------------------------------------

【java】maven dependency:tree中的符号啥意思

‘+-‘ 和 ‘-‘的区别
建议参考一下eclipsepom文件dependency Hierarchy功能

本文地址:H5W3 » 【java】maven dependency:tree中的符号啥意思

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址