我上次使用 Android Studio 时,它使用 mavencentral()
buildscript 存储库生成 .gradle
文件,而现在有 jcenter()
.
The last time I used Android Studio, it generated .gradle
files with mavencentral()
buildscript repositories whereas now there's jcenter()
.
谁能解释与此相关的问题.还有其他回购吗?我们什么时候应该切换它们?它们对项目、模块、库有什么影响?Android 开发人员还有其他必需品吗?
Could anyone explain the issues connected with this. Are there any other repos? When should we switch them? What impact do they have on projects, modules, libs? Any other essentials for Android developers?
谁负责维护这些存储库?
Who's responsible for maintaining those repos?
在 Bintray 我刚刚转发了 一篇非常详细的博文,描述了谷歌做出这一改变的原因.以下是最重要的几点:
At Bintray I just rebloged a very detailed blog post describing the reasons why Google made this change. Here are the most important points:
jcenter()
是 mavenCentral()
的超集,包含许多额外的存储库和工件.jcenter()
is a superset of mavenCentral()
, that encompasses many additional repositories and artifacts.关于性能改进,一些 android 开发者倡导者已经面临/注意到使用 maven Central 的巨大索引问题.
Regarding performance improvements, couple of android developer advocates had faced/noticed the issue of huge indexing with maven central.
用 托诺拜:
我使用全新的设置目录运行 AndroidStudio,因此它连接了 maven Central 并下载了可用工件的索引.
I ran AndroidStudio with a brand new settings directory, so it went and connected maven central and downloaded an index of the available artifacts.
然后我碰巧看了一下我的目录的大小.
Then I happened to look at the size of my directory.
我的 ~/Library/Cache/AndroidStudioPreview 是 1.5G,其中 1.2G 被Maven"子目录占用.
My ~/Library/Cache/AndroidStudioPreview is 1.5G, and 1.2G of those are taken by the "Maven" subdirectory.
这太荒谬了.我们几乎不使用索引.它的主要用途是项目结构对话框中的依赖关系编辑器,但我们真的不需要为它预先计算索引.MavenCentral 有一个快速的在线 JSON 搜索,我们可以在有人搜索工件时按需使用.在 https://android-review.googlesource.com/#/c/94843/ 我们添加了一个 lint 检查来检查依赖项是否是最新的,并且对少数工件的搜索是几乎瞬间.
That’s ridiculous. We barely use the index at all. The primary use for it is the Dependency editor in the Project Structure Dialog, but we really don’t need to have a precomputed index for it. MavenCentral has a fast online JSON search we can use on demand when somebody searches for artifacts. In https://android-review.googlesource.com/#/c/94843/ we added a lint check which checks whether the dependencies are up to date, and the search for a handful of artifacts is near instant.
简而言之,我们真的不需要缓存;它可能有助于 .gradle 和 maven .pom 文件中的代码完成,但这不是一个超级重要的用例,当然也不是所有用户都应该牺牲 1.5G 的下载速度和磁盘空间来获得一天的可能性.阅读更多:Maven 索引巨大!
In short, we really don’t need the cache; it may help with code completion in .gradle and maven .pom files, but that’s not a super important usecase, and certainly not something all users should have to sacrifice 1.5G of download speed and diskspace to have the possibility of one day doing. Read more on: The Maven index is huge!
另外,您可能会发现这个 关于黑客新闻的简短讨论(1Q 和 1A) 很有趣.
Also, you might find this very short (1Q and 1A) discussion on Hacker News interesting.
我在 JFrog,这是 bintray 和 artifactory,有关详细信息,请参阅 我的个人资料链接.
I am with JFrog, the company behind bintray and artifactory, see my profile for details and links.
这篇关于Android buildscript 存储库:jcenter VS mavencentral的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!