gpt4 book ai didi

maven - Gradle依赖-com.google.auto:自动共享:1.0-SNAPSHOT

转载 作者:行者123 更新时间:2023-12-03 03:15:08 25 4
gpt4 key购买 nike

如何在gradle版本中解决com.google.auto:auto-common:1.0-SNAPSHOT(传递依赖项)的问题?

build.gradle:

apply plugin: 'java'

repositories {
maven {
mavenLocal()
mavenCentral()
url "http://snapshots.maven.codehaus.org/maven2"
url "http://oss.sonatype.org/content/groups/public"
url "http://nativelibs4java.sourceforge.net/maven"
url "http://repository.jboss.org/"
}
}

dependencies {
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
compile 'com.google.dagger:dagger-compiler:2.0-SNAPSHOT'
compile 'com.google.guava:guava:18.0'
compile 'com.google.protobuf:protobuf-java:2.6.1'

compile 'com.nativelibs4java:javacl:1.0-SNAPSHOT'
compile 'org.jogamp.gluegen:gluegen-rt-main:2.0.2'
compile 'org.jogamp.jogl:jogl-all-main:2.0.2'

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'com.google.truth:truth:0.25'
}

结果:
$ gradle build
:compileJava

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Artifact 'com.google.auto:auto-common:1.0-SNAPSHOT@jar' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

依赖关系树:(被截断)
$ gradle dependencies

compile - Classpath for compiling the main sources.
+--- com.google.dagger:dagger:2.0-SNAPSHOT
| \--- javax.inject:javax.inject:1
+--- com.google.dagger:dagger-compiler:2.0-SNAPSHOT
| +--- com.google.dagger:dagger:2.0-SNAPSHOT (*)
| +--- com.google.dagger:dagger-producers:2.0-SNAPSHOT
| | +--- com.google.dagger:dagger:2.0-SNAPSHOT (*)
| | \--- com.google.guava:guava:18.0
| +--- com.google.auto:auto-common:1.0-SNAPSHOT <-------auto-common--------
| | \--- com.google.guava:guava:18.0
| \--- com.google.guava:guava:18.0
+--- com.google.guava:guava:18.0
+--- com.google.protobuf:protobuf-java:2.6.1
+--- com.nativelibs4java:javacl:1.0-SNAPSHOT
| \--- com.nativelibs4java:javacl-core:1.0-SNAPSHOT
| +--- com.nativelibs4java:opencl4java:1.0-SNAPSHOT
| | \--- com.nativelibs4java:bridj:0.7-SNAPSHOT
| | \--- com.google.android.tools:dx:1.7
| \--- com.nativelibs4java:nativelibs4java-utils:1.6-SNAPSHOT
+--- org.jogamp.gluegen:gluegen-rt-main:2.0.2
| \--- org.jogamp.gluegen:gluegen-rt:2.0.2
\--- org.jogamp.jogl:jogl-all-main:2.0.2
\--- org.jogamp.jogl:jogl-all:2.0.2

我已经尝试为auto-common添加显式依赖项,但是没有运气。

令我惊讶的是,搜索“com.google.auto:auto-common:1.0-SNAPSHOT存储库”之类的东西很少。看起来1.0-SNAPSHOT根本不在Maven Central中。有趣的是,在jboss的存储库中看起来1.0-SNAPSHOT的 ,但是我的gradle构建似乎找不到它。

有人看过这样的东西吗?救命?

最佳答案

它将以以下方式工作-每个Maven网址应在单独的maven{}块中指定-运行copyToLibs任务进行验证:

apply plugin: 'java'

repositories {
mavenLocal()
mavenCentral()
[
"http://snapshots.maven.codehaus.org/maven2",
"http://oss.sonatype.org/content/groups/public",
"http://nativelibs4java.sourceforge.net/maven",
"http://repository.jboss.org/"
].each { address ->
maven {
url address
}
}
}

dependencies {
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
compile 'com.google.dagger:dagger-compiler:2.0-SNAPSHOT'
compile 'com.google.guava:guava:18.0'
compile 'com.google.protobuf:protobuf-java:2.6.1'

compile 'com.nativelibs4java:javacl:1.0-SNAPSHOT'
compile 'org.jogamp.gluegen:gluegen-rt-main:2.0.2'
compile 'org.jogamp.jogl:jogl-all-main:2.0.2'

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'com.google.truth:truth:0.25'
}

task copyToLib(type: Copy) {
from configurations.runtime
into 'libs'
}

用您指定最后一个获胜的网址的方式(覆盖所有先前定义的网址)。

关于maven - Gradle依赖-com.google.auto:自动共享:1.0-SNAPSHOT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28710542/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com