【发布时间】:2020-06-30 21:10:15
【问题描述】:
我有一个具有复杂依赖关系的 Gradle 项目,我可以使用 ./gradlew module-name:dependencies 看到它:
[...]
testRuntimeClasspath - Runtime classpath of source set 'test'.
+--- org.apache.logging.log4j:log4j-core -> 2.11.0
| \--- org.apache.logging.log4j:log4j-api:2.11.0
+--- com.google.guava:guava -> 20.0
+--- project :xxx
| +--- org.springframework:spring-tx -> 5.1.7.RELEASE
| | +--- org.springframework:spring-beans:5.1.7.RELEASE
| | | \--- org.springframework:spring-core:5.1.7.RELEASE
| | | \--- org.springframework:spring-jcl:5.1.7.RELEASE
| | \--- org.springframework:spring-core:5.1.7.RELEASE (*)
| +--- org.springframework:spring-context -> 5.1.7.RELEASE
| | +--- org.springframework:spring-aop:5.1.7.RELEASE
| | | +--- org.springframework:spring-beans:5.1.7.RELEASE (*)
| | | \--- org.springframework:spring-core:5.1.7.RELEASE (*)
| | +--- org.springframework:spring-beans:5.1.7.RELEASE (*)
| | +--- org.springframework:spring-core:5.1.7.RELEASE (*)
| | \--- org.springframework:spring-expression:5.1.7.RELEASE
| | \--- org.springframework:spring-core:5.1.7.RELEASE (*)
[...]
当我排除嵌套依赖并明确包含它们时,结果可能如下所示:
[...]
testRuntimeClasspath - Runtime classpath of source set 'test'.
+--- org.apache.logging.log4j:log4j-core -> 2.11.0
| \--- org.apache.logging.log4j:log4j-api:2.11.0
+--- com.google.guava:guava -> 20.0
+--- project :xxx
| +--- org.springframework:spring-context -> 5.1.7.RELEASE
| | +--- org.springframework:spring-aop:5.1.7.RELEASE
| | | +--- org.springframework:spring-beans:5.1.7.RELEASE (*)
| | | \--- org.springframework:spring-core:5.1.7.RELEASE (*)
| | +--- org.springframework:spring-beans:5.1.7.RELEASE (*)
| | +--- org.springframework:spring-core:5.1.7.RELEASE (*)
| | \--- org.springframework:spring-expression:5.1.7.RELEASE
| | \--- org.springframework:spring-core:5.1.7.RELEASE (*)
+--- org.springframework:spring-tx -> 5.1.7.RELEASE
| +--- org.springframework:spring-beans:5.1.7.RELEASE
| | \--- org.springframework:spring-core:5.1.7.RELEASE
| | \--- org.springframework:spring-jcl:5.1.7.RELEASE
| \--- org.springframework:spring-core:5.1.7.RELEASE (*)
[...]
为了查看 set 的依赖关系是否发生了变化,我想比较 lists 的依赖关系。换句话说,我想展平上面显示的树视图,以便我可以专注于与传递包含无关的差异。
有了 Maven,我可以做到 mvn dependency:tree 和 mvn dependency:list。我如何使用 Gradle 做到这一点?
【问题讨论】:
标签: gradle