Maven API 搜索未检索 Google 依赖项

Maven API search doesn't retrieve Google dependcies

当我使用 Maven API 搜索功能时,它可以很好地处理 Central repo 中的依赖项(例如 retrofit),但是,它不会从 Google repo 中检索依赖项(例如 play-services-加)。尽管它们都可以在网络搜索中找到 https://mvnrepository.com.

改造
Play 服务增强版

如何在 Central repo 之外检索依赖项,我需要以编程方式进行,例如API?

您需要添加 Google maven 存储库,更新您的 settings.xml 文件以将其包含为:

        <repository>
            <id>google</id>
            <url>https://maven.google.com/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

或您的 build.gradle 文件:

repositories {
    google()
}

mvnrepository.com 详细说明了依赖项可用的位置,如果您重新访问 url,它会在 'Compile Dependencies' 部分的上方详细说明

要以编程方式搜索'Google's Maven Repository',您可以搜索组-index.xml 通过 https://maven.google.com/group_path/group-index.xml

寻找您要寻找的神器

所以在你的情况下你会搜索:

https://maven.google.com/com/google/android/gms/group-index.xml

要获取您选择的 artifact/version 的发布数据(pom 或 aar),您可以使用以下语法执行 GET:https://maven.google.com/group_path/library/version/library-version.ext(其中 ext 是 pom 或 aar)

因此,在您的情况下,您将为以下对象执行 GET:

https://maven.google.com/com/google/android/gms/play-services-plus/16.0.0/play-services-plus-16.0.0.pom

or

https://maven.google.com/com/google/android/gms/play-services-plus/16.0.0/play-services-plus-16.0.0.aar