java - maven dependency:tree中的符号啥意思
迷茫
迷茫 2017-04-18 09:25:51
[Java讨论组]

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

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

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

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全部回复(2)
黄舟

给你参考对比一下就明白了。截图如下:
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] ------------------------------------------------------------------------

大家讲道理

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号