JCenter deprecation; impact on Gradle and Android
Solution 1
The latest update as mentioned here in JFrog's website is the following:
UPDATE 4/27/2021: We listened to the community and will keep JCenter as a read-only repository indefinitely. Our customers and the community can continue to rely on JCenter as a reliable mirror for Java packages.
Solution 2
Replace
jcenter()
with this:
mavenCentral()
Solution 3
Please see the new answer.
Summary: After February 1st, 2022 jcenter()
will not work anymore.
According to this Gradle blog post:
Gradle 7.0 will deprecate the use of
jcenter()
to resolve dependencies.
You will still be able to use JCenter as a repository, but Gradle will emit a warning.
Thejcenter()
method will be removed in the next major release.Gradle has no inherent tie to JCenter or Maven Central, so you can always switch to any other repository of your choice.
And according to Android Developers:
JFrog, the company that maintains the JCenter artifact repository used by many Android projects, recently announced the deprecation and upcoming retirement of JCenter.
According to the announcement, JCenter will allow downloads of existing artifacts until February 1, 2022.Developers who publish artifacts on JCenter should start migrating packages to a new host, such as Maven Central.
So, just make sure that the authors provide their library in other repositories and then update your build scripts to enable downloading from those repositories.
For example, in Gradle use mavenCentral()
function to enable getting dependencies from Maven Central repository.
Solution 4
Replace jcenter()
by:
gradlePluginPortal()
mavenCentral()
Solution 5
You have to change
jcenter()
with
mavenCentral()
moreover you have to set one or more repository urls:
repositories {
mavenCentral()
maven {
url = "https://repo1.maven.org/maven2/"
}
maven {
url "https://repo.spring.io/release"
}
maven {
url "https://repository.jboss.org/maven2"
}
maven {
url 'https://repo.jenkins-ci.org/public/'
}
}
Mahozad
Software Developer. Interested in programming especially in Kotlin and Java. Also likes creating vector graphics and loves the SVG format.
Updated on July 08, 2022Comments
-
Mahozad almost 2 years
Should I be worried about JCenter being deprecated?
Why should I migrate my libraries from JCenter to other Maven repositories?
Can I continue to use
jcenter()
in my Gradle build script? -
Mahozad almost 3 yearsNote that the library should be available on Maven Central repository. Otherwise, simply replacing
jcenter()
withmavenCentral()
will do no good. -
Literate Corvette almost 3 yearsDo you have any tips on option B? I program for a barcode scanner that runs Android and I already am pretty sure the manufacturer's devs are gonna be late to this party.
-
The incredible Jan almost 3 yearsWrong. "May 1st, 2021 Bintray services will no longer be available. GoCenter, and ChartCenter services will no longer be available to non-Artifactory clients. (ConanCenter and JCenter are not affected)." and "UPDATE 4/27/2021: We listened to the community and will keep JCenter as a read-only repository indefinitely. Our customers and the community can continue to rely on JCenter as a reliable mirror for Java packages."
-
togikan almost 3 yearsThe Gradle Plugin Portal implicitly mirrors JCenter currently. If you’re using the Plugin Portal (via gradlePluginPortal() or the URL plugins.gradle.org/m2) to resolve your application’s dependencies, you may be relying on JCenter. You should avoid using the Plugin Portal as a repository, except for Gradle plugin projects. blog.gradle.org/jcenter-shutdown
-
nnhthuan almost 3 years@togikan It's absolutely gradle plugin projects, as it's default for android projects. Or maybe not if the owner of this question used something else.
-
Peter Mortensen almost 3 yearsAnother answer contradicts the statement in the last paragraph.
-
Stan over 2 yearsJCenter itself may keep working, but it will get deprecated and removed from various tools, like Gradle. So effectively, most people need to stop using it.
-
cmak over 2 years@Mahozad True, in some cases, we'll need to go to developer's site and copy the maven line that usually looks like this:
maven {url 'https://my.library-url.com/'}
-
Mehmet Fatih Yıldız about 2 yearsThank you. After many other answers, this one worked - probably because it has the correct mirrors that has the older versions of dependencies my project is still using. I only want it to get it working. I can't upgrade everything...
-
Nhân Trần almost 2 years@Stan how to stop? I am using shadow plugin for Gradle, and it is only on jcenter
-
reducing activity almost 2 yearsis mavenCentral mirroring entire jcenter?
-
reducing activity almost 2 years"The Gradle Plugin Portal implicitly mirrors JCenter currently" is there some info how long they will be definitely doing this?
-
reducing activity almost 2 years> jcenter() method will be removed in the next major release This is still applicable, right? How it can be replaced?
-
N3tMaster almost 2 years@reducingactivity : yes it should be