Is gradle possible to use maven repository with higher priority than jcenter

MK at Soho picture MK at Soho · Nov 4, 2015 · Viewed 8.8k times · Source

Gradle can set multiple repositories, e.g. maven and jcenter. But I realized gradle always use jcenter first even if I put maven before jcenter (as below). Is it possible to make maven (local repo, and faster) have higher priority?

## in file build.gradle
allprojects {
    repositories {
    maven { url "http://nexus.mucompany.com/nexus/service/local/repositories/releases/content/" }
    jcenter()
}

Answer

lemoncurd picture lemoncurd · Nov 4, 2015

I would like to ask this as a comment, but haven't got enough rep yet :-/

Can you post the output from gradle --debug that makes you think it resolving from jcenter in preference?

The gradle docs contain the following:

A project can have multiple repositories. Gradle will look for a dependency in each repository in the order they are specified, stopping at the first repository that contains the requested module.

An quick confirmation locally shows that the order is being honored between custom maven repositories and jcenter()