0
我有一个项目有两个Android Gradle模块:一个库,:mylib
和一个应用程序,:demo
。在build.gradle
为:demo
,我添加了一个依赖于:mylib
:Gradle无法找到传递依赖关系模块依赖
dependencies {
compile project(':mylib')
}
反过来,:mylib
有这种依赖性:
dependencies {
compile 'com.google.code.ksoap2-android:ksoap2-android:3.5.0'
}
回购设置正确,并:mylib
建立了良好之前我添加了:demo
模块到项目。但现在当我建,我得到这个:
Error:Gradle: A problem occurred configuring project ':demo'.
> Could not resolve all dependencies for configuration ':demo:_debugCompile'.
> Could not find com.google.code.ksoap2-android:ksoap2-android:3.5.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
file:/home/kevin/local/android-sdk-linux/extras/android/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
file:/home/kevin/local/android-sdk-linux/extras/android/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
file:/home/kevin/local/android-sdk-linux/extras/google/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
file:/home/kevin/local/android-sdk-linux/extras/google/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
Required by:
MyProject:demo:unspecified > MyProject:mylib:unspecified
我不明白为什么:demo
甚至知道:mylib
使用ksoap2,更不用说为什么它会尝试解决的依赖本身。我不认为在:mylib
中有任何public
甚至protected
,揭示了它使用ksoap2。
那么我的模块没有办法不公开自己解决的依赖关系? –
在maven仓库中发布库也是一样。该库不会包含将包含在pom文件中的嵌套dependencies。在这种情况下,主项目也将解决嵌套的依赖关系。 –
啊。我在Eclipse工作区中概念化了一个模块依赖项,如项目依赖项。我期待它像一个超级罐子一样对待。 –