素材牛VIP会员
maven dependency:tree中的符号啥意思
 wu***su  分类:Java代码  人气:1191  回帖:2  发布于6年前 收藏

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

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

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

 标签:mavenjava

讨论这个帖子(2)垃圾回帖将一律封号处理……

Lv1 新人
袜***了 PHP开发工程师 6年前#1

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

[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] ------------------------------------------------------------------------

Lv3 码奴
lo***68 交互设计师 6年前#2

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

 文明上网,理性发言!   😉 阿里云幸运券,戳我领取