用mvn dependency:tree命令查看maven工程的依赖树信息

本文介绍了如何在Maven项目中使用`mvndependency:tree`命令查看依赖树,包括如何执行命令、输出内容解析以及重定向输出至文件的操作,对于理解和管理项目依赖非常有帮助。
摘要由CSDN通过智能技术生成

在cmd窗口下,到maven工程的根目录下,执行mvn dependency:tree命令,可以查看maven工程的依赖树信息。例如:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

如果输出的信息很长,要仔细看,可以将输出信息定向到一个文件中,例如执行命令mvn dependency:tree > test.txt可以将输出信息重定向到当前目录下的test.txt文件中:
在这里插入图片描述

打开test.txt文件,可以看到输出的内容:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:3.6.1:tree (default-cli) @ demo ---
[INFO] com.example:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:3.2.1:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:3.2.1:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:3.2.1:compile
[INFO] |  |  |  \- org.springframework:spring-context:jar:6.1.2:compile
[INFO] |  |  |     +- org.springframework:spring-aop:jar:6.1.2:compile
[INFO] |  |  |     \- org.springframework:spring-expression:jar:6.1.2:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:3.2.1:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:3.2.1:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.4.14:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.4.14:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.21.1:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.21.1:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:2.0.9:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:2.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:3.2.1:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.15.3:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.15.3:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.15.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.15.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.15.3:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.15.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:3.2.1:compile
[INFO] |  |  \- io.projectreactor.netty:reactor-netty-http:jar:1.1.14:compile
[INFO] |  |     +- io.netty:netty-codec-http:jar:4.1.104.Final:compile
[INFO] |  |     |  +- io.netty:netty-common:jar:4.1.104.Final:compile
[INFO] |  |     |  +- io.netty:netty-buffer:jar:4.1.104.Final:compile
[INFO] |  |     |  +- io.netty:netty-transport:jar:4.1.104.Final:compile
[INFO] |  |     |  +- io.netty:netty-codec:jar:4.1.104.Final:compile
[INFO] |  |     |  \- io.netty:netty-handler:jar:4.1.104.Final:compile
[INFO] |  |     +- io.netty:netty-codec-http2:jar:4.1.104.Final:compile
[INFO] |  |     +- io.netty:netty-resolver-dns:jar:4.1.104.Final:compile
[INFO] |  |     |  +- io.netty:netty-resolver:jar:4.1.104.Final:compile
[INFO] |  |     |  \- io.netty:netty-codec-dns:jar:4.1.104.Final:compile
[INFO] |  |     +- io.netty:netty-resolver-dns-native-macos:jar:osx-x86_64:4.1.104.Final:compile
[INFO] |  |     |  \- io.netty:netty-resolver-dns-classes-macos:jar:4.1.104.Final:compile
[INFO] |  |     +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.104.Final:compile
[INFO] |  |     |  +- io.netty:netty-transport-native-unix-common:jar:4.1.104.Final:compile
[INFO] |  |     |  \- io.netty:netty-transport-classes-epoll:jar:4.1.104.Final:compile
[INFO] |  |     \- io.projectreactor.netty:reactor-netty-core:jar:1.1.14:compile
[INFO] |  |        \- io.netty:netty-handler-proxy:jar:4.1.104.Final:compile
[INFO] |  |           \- io.netty:netty-codec-socks:jar:4.1.104.Final:compile
[INFO] |  +- org.springframework:spring-web:jar:6.1.2:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:6.1.2:compile
[INFO] |  \- org.springframework:spring-webflux:jar:6.1.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:3.2.1:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:3.2.1:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-actuator:jar:3.2.1:compile
[INFO] |  +- io.micrometer:micrometer-observation:jar:1.12.1:compile
[INFO] |  |  \- io.micrometer:micrometer-commons:jar:1.12.1:compile
[INFO] |  \- io.micrometer:micrometer-jakarta9:jar:1.12.1:compile
[INFO] |     \- io.micrometer:micrometer-core:jar:1.12.1:compile
[INFO] |        +- org.hdrhistogram:HdrHistogram:jar:2.1.12:runtime
[INFO] |        \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:3.2.1:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:3.2.1:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.2.1:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.8.0:test
[INFO] |  |  \- org.slf4j:slf4j-api:jar:2.0.9:compile
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.1:test
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:2.1.2:test
[INFO] |  +- net.minidev:json-smart:jar:2.5.0:test
[INFO] |  |  \- net.minidev:accessors-smart:jar:2.5.0:test
[INFO] |  |     \- org.ow2.asm:asm:jar:9.3:test
[INFO] |  +- org.assertj:assertj-core:jar:3.24.2:test
[INFO] |  |  \- net.bytebuddy:byte-buddy:jar:1.14.10:test
[INFO] |  +- org.awaitility:awaitility:jar:4.2.0:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.10.1:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.10.1:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.3.0:test
[INFO] |  |  |  +- org.junit.platform:junit-platform-commons:jar:1.10.1:test
[INFO] |  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.10.1:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.10.1:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.10.1:test
[INFO] |  +- org.mockito:mockito-core:jar:5.7.0:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.14.10:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.3:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:5.7.0:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.1:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-core:jar:6.1.2:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:6.1.2:compile
[INFO] |  +- org.springframework:spring-test:jar:6.1.2:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
[INFO] \- io.projectreactor:reactor-test:jar:3.6.1:test
[INFO]    \- io.projectreactor:reactor-core:jar:3.6.1:compile
[INFO]       \- org.reactivestreams:reactive-streams:jar:1.0.4:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.219 s
[INFO] Finished at: 2024-01-20T12:10:36+08:00
[INFO] ------------------------------------------------------------------------
  • 7
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值