首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mvn依赖项的替代方案:查看父版本的树

mvn依赖项的替代方案:查看父版本的树
EN

Stack Overflow用户
提问于 2018-07-24 22:30:51
回答 1查看 651关注 0票数 1

当您将mvn dependency:tree运行到某个spring引导项目时,您可以看到以下内容:

代码语言:javascript
复制
[INFO] com.example:demo:jar:1.0.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.0.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.0.2.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-context:jar:5.0.6.RELEASE:compile
[INFO] |  |     +- org.springframework:spring-aop:jar:5.0.6.RELEASE:compile
[INFO] |  |     +- org.springframework:spring-beans:jar:5.0.6.RELEASE:compile
[INFO] |  |     \- org.springframework:spring-expression:jar:5.0.6.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.2.RELEASE:compile
[INFO] |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
[INFO] |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |  +- org.springframework:spring-core:jar:5.0.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.0.6.RELEASE:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.19:runtime

当您不覆盖它时,所有工件都会从父pom获得默认版本。是否有一些maven命令来检查项目父级的信息(版本)?

所以当pom.xml中有

代码语言:javascript
复制
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
</parent>

我想看看这样的东西

代码语言:javascript
复制
[INFO] +- org.springframework.boot:spring-boot-starter-parent:jar:2.0.1.RELEASE:compile
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-07-24 23:54:31

这不是显示您想要的确切输出,但它非常相似。

代码语言:javascript
复制
mvn -Dexec.executable='echo' -Dexec.args='${project.parent.groupId}: ${project.parent.artifactId}: ${project.parent.version}' --non-recursive exec:exec -q  

在Ubuntu上进行了测试,它在我的机器上展示了这样的东西:

org.springframework.boot: spring-boot-starter-parent: 1.5.9.RELEASE

-q:静默输出,只显示错误

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51508414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档