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

 王剑波200813 发布于 2022-10-27 11:39

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

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

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

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

    2022-10-27 22:12 回答
  • 给你参考对比一下就明白了。截图如下:
    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] ------------------------------------------------------------------------

    2022-10-27 22:13 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有