So our group has a private maven repository with a large number of libraries 'in-house'. So there only available on a vpn. bintray and jcenter is available on my vpn. What i want to do is have gradle check for a dependency first on the private maven repo, if not found then search bintray/jcenter for the library. How can i do this ? this is what i have tried:
In the top level build.gradle file i have:
buildscript {
    repositories {
        maven { url "https://myprivateRepo.com/libraries"
    }
        jcenter()
    }
my assumption was that it would first check maven private repo and then check with jcenter afterwards but it seems to not be working, can anyone verify the set up ?
You're adding the repositories for your buildscripts (or plugins). You need to add it to your project / dependencies level.
Using it with buildscript will resolve plugins. You need that e.g. if you are using apt: apply plugin: 'com.neenbedankt.android-apt'
Remove the wrapping buildscript block:
repositories {
    maven { url "https://myprivateRepo.com/libraries" }
    mavenCentral()
    jcenter()
}
dependencies {
    compile "my:library:1.0.0"
    // ...
}
Alternatively just set it on the project root build.gradle and apply to all projects like this
allprojects {
    repositories {
        maven { url "https://myprivateRepo.com/libraries" }
        mavenCentral()
        jcenter()
    }
}
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