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

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()


aside the fact, that at least in newer gradle versions the order matters:

It’s even more important when considering that order of repositories matter.

✨ The order of declaration determines how Gradle will check for dependencies at runtime. If Gradle finds a module descriptor in a particular repository, it will attempt to download all of the artifacts for that module from the same repository. You can learn more about the inner workings of Gradle’s resolution mechanism.

source: gradle 5.4.1 Declaring multiple repositories

or it's a bug in your specific gradle version - my answer might come "a bit late" that day 2k19 as you question was from '15 ;D

(at least in Gradle 3.5 it was defined similar

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.

source: gradle 3.5 Dependency Management for Java Projects )

a common problem is, that higher priorized repository AND / OR local cache are corrupt! Often enough artifactory jcenter proxy contains unwillingly POM declarations but no jars. You have then to cleanup the artifactory. Similar to local repositories.

you can try to ignore local caches by running gradle with --refresh-dependencies and best case -i logging enabled to see where requests go to and what are the results.

have a look at How can I force gradle to redownload dependencies?


Second option: as of gradle 5.1 you can always declare filters

see gradle 5.4.1 Declaring a repository filter

for me, I ignore any com.android packages from jcenter, which speeds up searching a bit and reduces the known problem mentioned above