微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Gradle 导入私有 maven 依赖项,但查找错误的 pom 文件名:double .pom.pom 扩展名

如何解决Gradle 导入私有 maven 依赖项,但查找错误的 pom 文件名:double .pom.pom 扩展名

我正在尝试解决与 Gradle 的依赖关系。直到今天它都运行良好。 我自己的依赖再也找不到了。应该使用 github 包找到依赖项。 这是我的配置:


    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    def propertiesFile = project.rootProject.file('local.properties')
    def props = new Properties()
    if (propertiesFile.exists()) {
        props.load(propertiesFile.newDataInputStream())
    }
    
    def githubPackagePassword = props.getProperty('github.package.password')
    def systemGithubPackagePassword = System.getenv('GIT_PACKAGE_PASSWORD')
    ext.github_package_password = githubPackagePassword != null ? githubPackagePassword : systemGithubPackagePassword
    
    buildscript {
        ext.kotlin_version = '1.3.20'
        repositories {
            google()
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:4.1.3'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha11'
            classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
            classpath 'com.google.gms:google-services:4.3.4'
            classpath 'com.google.firebase:firebase-appdistribution-gradle:1.3.1'
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven {
                url "https://plugins.gradle.org/m2/"
            }
            maven {
                url = uri("https://maven.pkg.github.com/SearchStartShare/3S-API")
                credentials {
                    username = "hidden username for stackoverflow"
                    password = github_package_password
                }
            }
        }
    }
    
    task clean(type: Delete) {
        

    delete rootProject.buildDir
    }

我收到以下错误


    Could not determine the dependencies of task ':app:compileDebugKotlin'.
    > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
       > Could not find com.sss:sss-util:2.1.6-SNAPSHOT.
         Searched in the following locations:
           - https://dl.google.com/dl/android/maven2/com/sss/sss-util/2.1.6-SNAPSHOT/maven-Metadata.xml
           - https://dl.google.com/dl/android/maven2/com/sss/sss-util/2.1.6-SNAPSHOT/sss-util-2.1.6-SNAPSHOT.pom
           - https://jcenter.bintray.com/com/sss/sss-util/2.1.6-SNAPSHOT/maven-Metadata.xml
           - https://jcenter.bintray.com/com/sss/sss-util/2.1.6-SNAPSHOT/sss-util-2.1.6-SNAPSHOT.pom
           - https://plugins.gradle.org/m2/com/sss/sss-util/2.1.6-SNAPSHOT/maven-Metadata.xml
           - https://plugins.gradle.org/m2/com/sss/sss-util/2.1.6-SNAPSHOT/sss-util-2.1.6-SNAPSHOT.pom
           - https://maven.pkg.github.com/SearchStartShare/3S-API/com/sss/sss-util/2.1.6-SNAPSHOT/maven-Metadata.xml
           - https://maven.pkg.github.com/SearchStartShare/3S-API/com/sss/sss-util/2.1.6-SNAPSHOT/sss-util-2.1.6-20210411.090340-1.pom.pom
         required by:
             project :app
    
    Possible solution:
     - Declare repository providing the artifact,see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

maven-Metadata.xml 已经很好找到了 https://maven.pkg.github.com/SearchStartShare/3S-API/com/sss/sss-util/2.1.6-SNAPSHOT/maven-Metadata.xml 但它没有找到 pom 文件。但看起来很正常,因为有一个pom 扩展名! https://maven.pkg.github.com/SearchStartShare/3S-API/com/sss/sss-util/2.1.6-SNAPSHOT/sss-util-2.1.6-20210411.090340-1.pom.pom

为什么有两个 pom 扩展? 我错过了什么?

PS:当我删除最后一个 .pom 并在 google url 搜索中复制 url 时,Github 会询问我的凭据。填完后,我得到了我的 pom 文件

以防万一,这是 maven-Metadata.xml 的内容


    com.ssssss-util2.1.6-SNAPSHOT20210411.0903401.pom20210411090347jar2.1.6-20210411.090340-120210411090342sha12.1.6-20210411.090340-1.jar20210411090343md52.1.6-20210411.090340-1.jar20210411090344pom2.1.6-20210411.090340-120210411090345sha12.1.6-20210411.090340-1.pom20210411090346md52.1.6-20210411.090340-1.pom20210411090347
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <Metadata modelVersion="">
    <groupId>com.sss</groupId>
    <artifactId>sss-util</artifactId>
    <version>2.1.6-SNAPSHOT</version>
    <versioning>
    <snapshot>
    <timestamp>20210411.090340</timestamp>
    <buildNumber>1.pom</buildNumber>
    ...
    </snapshot>
    <lastUpdated>20210411090347</lastUpdated>
    <snapshotVersions>
    <snapshotVersion>
    <extension>jar</extension>
    <value>2.1.6-20210411.090340-1</value>
    <updated>20210411090342</updated>
    ...
    </snapshotVersion>
    <snapshotVersion>
    <extension>sha1</extension>
    <value>2.1.6-20210411.090340-1.jar</value>
    <updated>20210411090343</updated>
    ...
    </snapshotVersion>
    <snapshotVersion>
    <extension>md5</extension>
    <value>2.1.6-20210411.090340-1.jar</value>
    <updated>20210411090344</updated>
    ...
    </snapshotVersion>
    <snapshotVersion>
    <extension>pom</extension>
    <value>2.1.6-20210411.090340-1</value>
    <updated>20210411090345</updated>
    ...
    </snapshotVersion>
    <snapshotVersion>
    <extension>sha1</extension>
    <value>2.1.6-20210411.090340-1.pom</value>
    <updated>20210411090346</updated>
    ...
    </snapshotVersion>
    <snapshotVersion>
    <extension>md5</extension>
    <value>2.1.6-20210411.090340-1.pom</value>
    <updated>20210411090347</updated>
    ...
    </snapshotVersion>
    ...
    </snapshotVersions>
    ...
    </versioning>
    ...
    </Metadata>

Android Gradle 插件版本:4.1.3 摇篮版本:7.0 (我多次尝试更改版本:()


---------------- 编辑 --------------------

我在 pom.xml 中将我的包声明为快照

    <artifactId>sss-util</artifactId>
    <name>sss-util</name>
    <version>2.2.4-SNAPSHOT</version>

我刚刚删除了后缀 -SNAPSHOT 现在它工作正常...... 不是真正的解决方案,我解决了这个问题。 我认为这是maven 3.5.4的一个错误,真的不知道

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。