java '->'(箭头)在 gradle 的依赖图中是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27952388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 12:41:57  来源:igfitidea点击:

What does '->' (arrow) mean in gradle's dependency graph?

javaandroidgradledependencies

提问by Some Noob Student

I'm trying to run some Android tests, however, the compiler complains that multiple dex files exist.

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

Multiple dex files define Lorg/hamcrest/MatcherAssert;

So I'm trying to filter duplicated dependencies: $ ./gradlew -q dependencies app:dependencies --configuration androidTestCompile

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

However I get the following output:

但是我得到以下输出:

------------------------------------------------------------
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)

I'm confused as what the arrows (->) mean. What do they mean?

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

回答by Opal

It means that dependency graph contains multiple dependencies with the same groupand modulebut different versions for e.g. org.hamcrest:hamcrest-core. Gradle tries to resolve conflicted versions automatically - by default the latest version is chosen. On the left side of ->is the requested version, on the right the version that will be picked. Heresimilar question can be found.

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