Grails Release 莫名其妙地无法发布到 Nexus

Grails Release Inexplicably Fails to Publish to Nexus

背景: 我正在尝试迁移项目以使用我们升级后的新 Nexus 实例,而不是旧实例。 Gradle 项目和 Maven 项目进展顺利,但 Grails 项目并非如此。

问题: 版本,以及单独的版本无法发布到新的 nexus。快照发布工作得很好。快照和发布发布在旧的 nexus 中都运行良好,我使用相同用户凭证的 Maven 和 Gradle 项目也运行良好。

错误如下

POM generated: /var/atlassian/application-data/bamboo/xml-data/build-dir/CS-AREL-JOB1/target/pom.xml.

[deploy] Deploying to https://nexus.mydomain.com/repository/maven-releases/

[deploy] Uploading: com/mydomain/myproject-admin/1.11.9/myproject-admin-1.11.9.war to repository atlassian_nexus_releases at https://nexus.mydomain.com/repository/maven-releases/

[deploy] Transferring 44484K from atlassian_nexus_releases

[deploy] Error writing to server

[deploy] An error has occurred while processing the Maven artifact tasks.

[deploy] Diagnosis:

[deploy]

[deploy] Error deploying artifact 'com.mydomain:myproject-admin:war': Error deploying artifact: Error transferring file

[deploy] Error writing to server

我需要一些关于在哪里查看的想法,因为所有常见检查似乎都不是问题。 用户凭据正确并且适用于 gradle 和 Maven 项目。 URL 是正确的,适用于 gradle 和 maven 项目。构建在旧的 nexus 和新的 nexus 使用之间没有变化,所以我假设构建仍然正确地生成发布工件而不是快照工件。还有什么问题?

配置:

grails.settings.groovy

grails.project.dependency.authentication = {
    repositories {
        mavenRepo "https://nexus.mydomain.com/repository/maven-public/"
    }
    credentials {
        id = "atlassian_nexus"
        username = "dev_read_user"
        password = "****"
    }
}
grails.project.ivy.authentication = {
    repositories {
        mavenRepo "https://nexus.mydomain.com/repository/maven-public/"
    }
    credentials {
        realm = "Sonatype Nexus Repository Manager"
        host = "atlassian.mydomain.com"
        username = "dev_read_user"
        password = "****"
    }
}
grails.project.dependency.distribution = {
    localRepository = "~/.m2/"
    remoteRepository(id: "atlassian_nexus_snapshots", url: 'https://nexus.mydomain.com/repository/maven-snapshots/'){
        authentication(username: 'nexus_user', password: '****')
    }
    remoteRepository(id: "atlassian_nexus_releases", url: 'https://nexus.mydomain.com/repository/maven-releases/'){
        authentication(username: 'nexus_user', password: '****')
    }
}

上面的文件在迁移过程中变化最大,所以我认为它是最有可能的罪魁祸首,尽管 nexus 本身的某些配置也可能是一个问题?

bamboo-build-release.sh

echo 'Making and commiting release version...';
JAVA_HOME=$bamboo_jdk_1_8 \
./grailsw version-update x.x.x --non-interactive;
git commit -m 'Increment version to release' -- application.properties;

echo 'Creating and pushing tag...';
grep app.version application.properties | cut -d"=" -f2 | xargs -I 
version git tag -a version -m "Tag Release";
git push $GIT_URL --tags;

echo 'Building RELEASE war and publishing to Nexus...';
JAVA_HOME=$bamboo_jdk_1_8 \
./grailsw prod maven-deploy --repository=atlassian_nexus_releases -- non-interactive -verbose;

echo 'Incrementing to next snapshot...';
JAVA_HOME=$bamboo_jdk_1_8 \
./grailsw version-update p s --non-interactive;

echo 'Committing and pushing version changes...';
git commit -m 'Increment version to next snapshot' --application.properties;
git push $GIT_URL $GIT_BRANCH;

echo 'Completed bamboo-build-release.sh';

我在上面的构建文件中所做的唯一更改是添加“-verbose”,这样我就可以获得有关失败原因的更多信息。如上所示,它没有提供有关发布失败原因的更多详细信息。

我确认生成的 pom 指定了正确的非快照版本:

<?xml version='1.0' encoding='UTF-8'?>
<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mydomain</groupId>
  <artifactId>myproject-admin</artifactId>
  <packaging>war</packaging>
  <version>1.11.9</version>
  <name>myproject-admin</name>
</project>

请告知我可能正在寻找的导致问题的想法。

虽然我仍然不确定为什么它始终无法发布并适用于快照,但以下间歇性 ivy-to-nexus-failures 解决方案对我有用:https://support.sonatype.com/hc/en-us/articles/218101688-Ivy-deploy-fails-intermittently-with-java-io-IOException-Error-writing-to-server-

我最终在 BuildConfig.groovy 文件中添加了以下依赖项:

dependencies{
    build 'commons-codec:commons-codec:1.7'
    build 'commons-httpclient:commons-httpclient:3.1'
    build 'commons-logging:commons-logging:1.1.1'

    // other dependencies...
}