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()
}
Gradle can resolve dependencies from one or many repositories based on Maven, Ivy or flat directory formats.
JFrog announced in this article that JCenter would be deprecated in May of 2021.
The jcenter() method will be removed in the next major release. Packages that are hosted on JCenter will need to find an alternative repository to provide updates after March 31 2021. Many packages will likely migrate to Maven Central, but some packages may not migrate at all and some may only publish new versions.
jCenter is the public repository hosted at bintray that is free to use for open source library publishers. It is the largest repository in the world for Java and Android OSS libraries, packages and components. All the content in JCenter is served over a CDN, with a secure HTTPS connection.
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()
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