首页 > 解决方案 > Gradle 5.3 发布 SNAPSHOT BadRequest 错误

问题描述

运行 gradle 发布步骤时,我在 circleci 构建中收到错误消息。我正在使用 gradle 5.3 并意识到他们在 5.4.1 中更改了此功能。但是,我不明白为什么这在我使用的版本中失败了。

group = 'com.talentreef.notification.commons'
version = '1.0.0-SNAPSHOT'

publishing {
    publications {
        maven(MavenPublication) {
            from components.java
        }
    }
    repositories {
        maven {
            def releaseRepoUrl = "https://nexus.trdev.co/nexus/content/repositories/releases"
            def snapshotRepoUrl = "https://nexus.trdev.co/nexus/content/repositories/snapshots"
            url = version.endsWith('SNAPSHOT') ? snapshotRepoUrl : releaseRepoUrl
            credentials {
                username = rootProject.ext.nexus.username
                password = rootProject.ext.nexus.password
            }
        }
    }
}

    * What went wrong:
Execution failed for task ':publishMavenPublicationToMavenRepository'.
> Failed to publish publication 'maven' to repository 'maven'
   > Could not write to resource 'https://nexus.trdev.co/nexus/content/repositories/snapshots/com/talentreef/notification/commons/notification-commons/1.0.0-SNAPSHOT/notification-commons-1.0.0-20190619.182943-1.jar'.
      > Could not PUT 'https://nexus.trdev.co/nexus/content/repositories/snapshots/com/talentreef/notification/commons/notification-commons/1.0.0-SNAPSHOT/notification-commons-1.0.0-20190619.182943-1.jar'. Received status code 400 from server: Bad Request

好的,所以它似乎失败了,因为存储库是策略类型“发布”而不是快照。

在此处输入图像描述

标签: mavengradlenexus

解决方案


推荐阅读