I would like to know if there is a way to force gradle to use a repository for one dependency. For instance with:
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://www.testfairy.com/maven' }
maven { url 'https://maven.fabric.io/repo' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath "io.fabric.tools:gradle:1.+"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile project(':shimmer')
compile('com.twitter.sdk.android:twitter:1.1.1@aar') {
transitive = true;
}
compile('com.twitter.sdk.android:tweet-composer:0.7.2@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:21.0.3'
// Dagger 2 dependencies
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
apt 'com.google.dagger:dagger-compiler:2.0-SNAPSHOT'
provided 'org.glassfish:javax.annotation:10.0-b28'
}
I want com.google.dagger
to be checked out from https://oss.sonatype.org/content/repositories/snapshots
because for now it tries to check it out from https://maven.fabric.io/repo
which result in the following error:
Error:Could not GET 'https://maven.fabric.io/repo/com/google/dagger/
dagger-compiler/2.0-SNAPSHOT/maven-metadata.xml'. Received status code 401 from server: Unauthorized
<a href="toggle.offline.mode">Enable Gradle 'offline mode' and sync project</a>
Thank you.
Same thing happened to me last night, I could solve by adding the following lines in gradle file.
compile 'com.google.dagger:dagger:2.1-SNAPSHOT'
apt 'com.google.dagger:dagger-compiler:2.1-SNAPSHOT'
Version 2.0 is not already available in the repository.
No, not yet. The ordering is important, so you could try putting the fabric.io repo last.
When I try this locally from the command-line, I see dagger come from sonatype without changing anything. Does it work from the command-line for you too?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With