Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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()
}
like image 529
MK at Soho Avatar asked Nov 04 '15 17:11

MK at Soho


People also ask

Can gradle use Maven repositories?

Gradle can resolve dependencies from one or many repositories based on Maven, Ivy or flat directory formats.

Is jcenter deprecated?

JFrog announced in this article that JCenter would be deprecated in May of 2021.

Why is jcenter shutting down?

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.

What is jcenter repository in gradle?

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.


1 Answers

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

like image 114
lemoncurd Avatar answered Oct 05 '22 03:10

lemoncurd