How do I get com.google.auto:auto-common:1.0-SNAPSHOT (transitive dependency) to resolve, in my gradle build?
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'
}
Results:
$ 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
Dependency Tree: (truncated)
$ 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
I have tried adding an explicit dependency for auto-common, with no luck.
To my surprise, searching things like "com.google.auto:auto-common:1.0-SNAPSHOT repository" turns up very little. It looks like the 1.0-SNAPSHOT simply isn't in Maven Central. Interestingly enough, it looks like the 1.0-SNAPSHOT is in jboss's repository, but my gradle build doesn't seem to find it.
Anyone seen something like this before? Help?
It will work in the following way - every maven url should be specified in a separate maven{}
block - run copyToLibs
task to verify:
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'
}
In the way You specified the urls the last one was winning (covering all previously defined).