在 Maven 2 中,您可以使用以下方法来确定依赖关系来自哪个依赖项:
mvn dependency:tree
命令查看依赖树。在项目根目录下运行此命令,它将显示项目中所有依赖项及其版本,以及它们的传递依赖关系。
例如:
$ mvn dependency:tree
INFO Scanning for projects...
INFO
INFO ------------------< com.example:my-project >-------------------
INFO Building my-project 1.0-SNAPSHOT
INFO -------------------------------- jar ---------------------------------
INFO
INFO --- maven-dependency-plugin:2.8:tree (default-cli) @ my-project ---
INFO com.example:my-project:jar:1.0-SNAPSHOT
INFO +- org.springframework.boot:spring-boot-starter-web:jar:2.5.4:compile
INFO | +- org.springframework.boot:spring-boot-starter:jar:2.5.4:compile
INFO | | +- org.springframework.boot:spring-boot:jar:2.5.4:compile
INFO | | | - org.springframework.boot:spring-boot-autoconfigure:jar:2.5.4:compile
INFO | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.5.4: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.14.1:compile
INFO | | | | - org.apache.logging.log4j:log4j-api:jar:2.14.1:compile
INFO | | | - org.slf4j:jul-to-slf4j:jar:1.7.32:compile
INFO | | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.5.4:compile
INFO | | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.50:compile
INFO | | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.50:compile
INFO | | | - org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.50:compile
INFO | | +- org.springframework:spring-web:jar:5.3.9:compile
INFO | | | - org.springframework:spring-beans:jar:5.3.9:compile
INFO | | - org.springframework:spring-webmvc:jar:5.3.9:compile
INFO | | +- org.springframework:spring-aop:jar:5.3.9:compile
INFO | | +- org.springframework:spring-context:jar:5.3.9:compile
INFO | | - org.springframework:spring-expression:jar:5.3.9:compile
INFO | +- org.springframework.boot:spring-boot-starter-validation:jar:2.5.4:compile
INFO | | +- javax.validation:validation-api:jar:2.0.1.Final:compile
INFO | | - org.hibernate.validator:hibernate-validator:jar:6.2.0.Final:compile
INFO | | +- org.hibernate.validator:hibernate-validator-cdi:jar:6.2.0.Final:compile
INFO | | +- javax.validation:validation-api:jar:2.0.1.Final:compile
INFO | | +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
INFO | | - com.fasterxml:classmate:jar:1.5.1:compile
INFO | +- org.springframework.boot:spring-boot-starter-json:jar:2.5.4:compile
INFO | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.5:compile
INFO | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.5:compile
INFO | | | - com.fasterxml.jackson.core:jackson-core:jar:2.12.5:compile
INFO | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.12.5:compile
INFO | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.12.5:compile
INFO | | - com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.12.5:compile
INFO | - com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.12.5:compile
INFO | +- org.yaml:snakeyaml:jar:1.27:compile
INFO | - com.fasterxml.jackson.core:jackson-databind:jar:2.12.5:compile
INFO | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.5:compile
INFO | - com.fasterxml.jackson.core:jackson-core:jar:2.12
领取专属 10元无门槛券
手把手带您无忧上云