什么是 Android Studio 中的 Maven 存储库?

Fél*_*roy 8 java android gradle maven

任何人都可以清楚地解释Maven repositoryAndroid Studio 中的内容吗?我试图理解它,但我找不到更好的解释。上次我需要在我的项目中添加一些依赖项,但直到我Maven and Jcenter在我的build.gradle文件中添加了一个链接,它们才起作用。

它完美地工作,但我的问题只是想知道 Android Studio 中的 maven 和 Jcenter 到底是什么?提前感谢您的回答。

Gab*_*tti 10

Maven 存储库是公共或私有的“存储库”,用于存储库、插件和一般工件。
它与 Android Studio 或其他 IDE 无关。

JCenter是 Maven 存储库之一。

JCenter 是查找和共享流行的 Apache Maven 包的地方,供 Maven、Gradle、Ivy、SBT 等使用。

Android 中使用的其他常见 repo 是:

gradle 脚本中,您可以在repositories块中找到它们:

/**
     * The repositories block configures the repositories Gradle uses to
     * search or download the dependencies. Gradle pre-configures support for remote
     * repositories such as JCenter, Maven Central, and Ivy. You can also use local
     * repositories or define your own remote repositories. The code below defines
     * JCenter as the repository Gradle should use to look for its dependencies.
     *
     * New projects created using Android Studio 3.0 and higher also include
     * Google's Maven repository.
     */
repositories {
        google()
        jcenter()
    }
Run Code Online (Sandbox Code Playgroud)