Android buildscript存储库:jcenter VS mavencentral [英] Android buildscript repositories: jcenter VS mavencentral

查看:201
本文介绍了Android buildscript存储库:jcenter VS mavencentral的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上次使用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?

谁负责维护这些回购?

推荐答案

在Bintray,我刚刚重新启动了详细的博客文章描述了Google进行此更改的原因。以下是最重要的要点:

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是 Bintray中的Java存储库,它是世界上最大的Java和Android OSS库,包和组件的回购。

  • JCenter中的所有内容都通过CDN提供,使用安全的HTTPS连接。回到迁移时(Android Studio 0.8)中央maven 2存储库仅限HTTP,不支持HTTPS。参考: 51.6.2。 Maven中央存储库

  • jcenter() mavenCentral()的超集,其中包含许多额外的存储库和工件。

  • 在不同的场景和来自不同国家的Bintray比Maven Central(例如来自以色列)更快。在其他地方,它非常接近。由于Maven Central和Bintray使用不同的CDN,这些CDN自适应地支持区域,因此可能会改变两种方式。

  • Bintray与传统的Maven Central有不同的包识别方法。 这是一个严重的安全问题。这很重要。

  • 如果你真的需要把你的包送到Maven Central(用于支持遗留工具),你也可以从Bintray那里做到,点击按钮甚至自动

  • JCenter is a Java repository in Bintray, which is the largest repo 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. Back in the time of the migration (Android Studio 0.8) The central maven 2 repository was HTTP only and HTTPS wasn't supported. Reference: 51.6.2. Maven central repository.
  • jcenter() is a superset of mavenCentral(), that encompasses many additional repositories and artifacts.
  • In different scenarios and from different countries Bintray is faster than Maven Central (e.g. from Israel). In others it is very close. Since Maven Central and Bintray use different CDNs which adaptively favor regions, this might change to both ways.
  • Bintray has a different approach to package identification than the legacy Maven Central. This is a big and serious security matter. It is important.
  • If you really need to get your package to Maven Central (for supporting legacy tools) you can do it from Bintray as well, in a click of a button or even automatically.

关于性能改进,一些Android开发者倡导者已经面临/注意到maven central的巨大索引问题。

Regarding performance improvements, couple of android developer advocates had faced/noticed the issue of huge indexing with maven central.

Tor Norbye 的话来说:


我使用全新的设置目录运行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.

My~ / 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.

这是荒谬的OU中。我们几乎没有使用索引。它的主要用途是项目结构对话框中的依赖项编辑器,但我们实际上不需要为它预先计算索引。 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 神器,请参阅我的个人资料以获取详细信息和链接。

I am with JFrog, the company behind bintray and artifactory, see my profile for details and links.

这篇关于Android buildscript存储库:jcenter VS mavencentral的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆