2021年,“jcenter()”的最佳替代品?
安卓专家,
请从您的构建脚本中删除 `jcenter()` Maven 存储库的使用,并将您的构建迁移到其他 Maven 存储库。
在今天的实践中,我应该用什么替换下面的“jcenter”?
不幸的是,在过去的一两年里,所有关于这方面的信息似乎都发生了巨大的变化?因此请教这里的专家。
应用程序只有在重要时才 24+。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta06'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
回答
我想目前的建议是使用 mavenCentral()。不幸的是,到目前为止,并非所有软件包都可用。据我所知,大多数项目将转移到或已经转移到 mavenCentral(显然是 Java 和其他与 JVM 相关的项目)。当前的日落时间延长至 2021 年 3 月下旬,这意味着,在此时间点之后,无法在 jcenter() 上发布任何新包,但仍可以从其检索(直到 2022 年 1 月)。
这可以在https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/上重新阅读,其中指出:
2021 年 5 月 1 日,日落将影响所有现有的 Bintray 用户。Bintray 用户将被屏蔽,无法再使用 Bintray 服务。这包括现有的软件分发、帐户管理访问、UI 访问和 REST API。
在此日期之后,JCenter 存储库仍将解析工件,但最终用户应迁移到规范存储库(例如,应从 Maven Central 检索 Java 包)。2022 年 2 月 1 日,JCenter 将只为 Artifactory 客户端解析工件。
- Thank you so much. I'm sure the answer will be very useful to many iOS devs who are making a droid app 🙂 So I replaced the text "jcenter" with "mavenCentral" and it works great. Fantastic. (I did get one problem where `Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.gorisse.thomas.sceneform:sceneform:1.18.5` I guess that package, on github, is not on mavenCentral ? :O