gradle的依赖图中“->”(箭头)是什么意思?


82

我正在尝试运行一些Android测试,但是,编译器抱怨存在多个dex文件。

Multiple dex files define Lorg/hamcrest/MatcherAssert;

所以我试图过滤重复的依赖项: $ ./gradlew -q dependencies app:dependencies --configuration androidTestCompile

但是我得到以下输出:

------------------------------------------------------------
Project :app
------------------------------------------------------------

androidTestCompile - Classpath for compiling the androidTest sources.
+--- org.mockito:mockito-core:1.9.5
|    +--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    \--- org.objenesis:objenesis:1.0 -> 2.1
+--- com.google.dexmaker:dexmaker-mockito:1.2
|    +--- com.google.dexmaker:dexmaker:1.2
|    \--- org.mockito:mockito-core:1.9.5 (*)
+--- com.android.support.test.espresso:espresso-core:2.0
|    +--- com.squareup:javawriter:2.1.1
|    +--- org.hamcrest:hamcrest-integration:1.1
|    |    \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    +--- org.hamcrest:hamcrest-library:1.1
|    |    \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    +--- javax.inject:javax.inject:1
|    +--- com.android.support.test.espresso:espresso-idling-resource:2.0
|    +--- com.android.support.test:testing-support-lib:0.1
|    |    \--- junit:junit-dep:4.10
|    |         \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
|    +--- com.google.code.findbugs:jsr305:2.0.1
|    +--- javax.annotation:javax.annotation-api:1.2
|    \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
+--- com.android.support.test:testing-support-lib:0.1 (*)
+--- org.powermock:powermock-module-junit4:1.5.6
|    +--- junit:junit:4.11
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    \--- org.powermock:powermock-module-junit4-common:1.5.6
|         +--- junit:junit:4.4 -> 4.11 (*)
|         +--- org.powermock:powermock-core:1.5.6
|         |    +--- org.powermock:powermock-reflect:1.5.6
|         |    |    \--- org.objenesis:objenesis:2.1
|         |    \--- org.javassist:javassist:3.18.2-GA
|         \--- org.powermock:powermock-reflect:1.5.6 (*)
\--- org.powermock:powermock-api-mockito:1.5.6
     \--- org.powermock:powermock-api-support:1.5.6
          +--- org.powermock:powermock-core:1.5.6 (*)
          \--- org.powermock:powermock-reflect:1.5.6 (*)

(*) - dependencies omitted (listed previously)

我对箭头(->)的含义感到困惑。他们的意思是什么?

Answers:


131

这意味着,依赖图包含相同的多个依赖groupmodule而不同的版本如org.hamcrest:hamcrest-core。Gradle尝试自动解决冲突的版本-默认情况下,选择最新版本。左侧->是请求的版本,右侧是将要选择的版本。在这里可以找到类似的问题。


1
我已经投票赞成,您能解释一下省略依赖项是什么意思吗?
java123999'1

1
这意味着在报告的其他地方,该依赖项已经与整个子依赖项一起呈现,因此这里仅是根源。
蛋白石

3
@ java123999。依赖项可能具有自己的依赖项。也可能会发生两次依赖关系被列出的情况。在这种情况下,将仅打印第一个条目的依赖项,而第二个条目将用标记(*)
蛋白石

1
所以*基本上表示重复的依赖项?
java123999'1

1
如果我不必至少写x个符号,请输入:是的。
蛋白石
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.