Maven 我如何在gradle中创建可传递依赖项?同时使用依赖项';什么是原始来源?
我有一个库,我称之为Maven 我如何在gradle中创建可传递依赖项?同时使用依赖项';什么是原始来源?,maven,gradle,dependency-management,Maven,Gradle,Dependency Management,我有一个库,我称之为core,它是另一个名为Museum项目的依赖项。在core的build.gradle中,我使用的是gson fire,它以以下方式指定为依赖项: repositories { maven { url 'https://raw.github.com/julman99/mvn-repo/master'} } ... dependencies { compile 'com.github.julman99:gson-fire:0.11.0' } 这工作正常-核心已编
core
,它是另一个名为Museum
项目的依赖项。在core
的build.gradle中,我使用的是gson fire
,它以以下方式指定为依赖项:
repositories {
maven { url 'https://raw.github.com/julman99/mvn-repo/master'}
}
...
dependencies {
compile 'com.github.julman99:gson-fire:0.11.0'
}
这工作正常-核心
已编译。但是,当我在我的博物馆项目中使用它时,我得到了以下信息:
A problem occurred configuring project ':Museum'.
> Could not resolve all dependencies for configuration ':Museum:_debugCompile'.
> Could not find com.github.julman99:gson-fire:0.11.0.
Searched in the following locations:
file:/Users/jwir3/.m2/repository/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.pom
file:/Users/jwir3/.m2/repository/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.jar
http://download.crashlytics.com/maven/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.pom
http://download.crashlytics.com/maven/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.jar
https://repo1.maven.org/maven2/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.pom
https://repo1.maven.org/maven2/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.jar
Required by:
museum:Museum:unspecified > com.jwir3.core:core:1.4.0-SNAPSHOT
dependencies {
compile ('com.thisclicks.core:core:' + project.CORE_LIB_VERSION+ '+@aar') {
transitive = true
}
}
博物馆的build.gradle
如下所示:
A problem occurred configuring project ':Museum'.
> Could not resolve all dependencies for configuration ':Museum:_debugCompile'.
> Could not find com.github.julman99:gson-fire:0.11.0.
Searched in the following locations:
file:/Users/jwir3/.m2/repository/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.pom
file:/Users/jwir3/.m2/repository/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.jar
http://download.crashlytics.com/maven/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.pom
http://download.crashlytics.com/maven/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.jar
https://repo1.maven.org/maven2/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.pom
https://repo1.maven.org/maven2/com/github/julman99/gson-fire/0.11.0/gson-fire-0.11.0.jar
Required by:
museum:Museum:unspecified > com.jwir3.core:core:1.4.0-SNAPSHOT
dependencies {
compile ('com.thisclicks.core:core:' + project.CORE_LIB_VERSION+ '+@aar') {
transitive = true
}
}
这大概是因为博物馆
的build.gradle
中将核心
库指定为transient=true
,但它没有搜索gson fire
的Maven存储库的正确位置。有没有办法使这些搜索位置和依赖项本身都是暂时的?不是自动的,没有。可传递的依赖项不会带来存储库信息,只有工件本身。如果您想让它工作,您必须将核心项目中的存储库{}
块添加到博物馆
项目中
此外,在这种情况下,不需要添加transitive=true
。无论如何,这是默认设置,如上所述,与此特定问题无关。请注意,另一个类似问题的答案是:,其中指出Gradle在解析依赖项时不尊重POMs中声明的存储库