背景
公司的 nexus 最近每天下午四五点就会出现缓慢的情况,在 nexus staging promote 到 release 的时候就老是会出现 TIMEOUT 的情况。
报错信息
Waiting for operation to complete...
..................................................................................
[WARNING] TIMEOUT after 300.2 s
[ERROR] Rule failure while trying to close staging repository with ID "comokta-1127".
[ERROR]
[ERROR] Nexus Staging Rules Failure Report
[ERROR] ==================================
[ERROR]
[ERROR]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary :
[INFO]
...
虽然是 TIMEOUT 报错,但是最后上 nexus 查看,其实是已经 deploy 到 release path 下面了。可恶的是,这个报错导致了我 jenkins pipeline 的往下执行。为了解决这个问题。在 Plugin 中增加 timeout 的超时时间。
解决方案
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>nexus</serverId>
<nexusUrl>https://nexushost/</nexusUrl>
<stagingProgressTimeoutMinutes>20</stagingProgressTimeoutMinutes>
</configuration>
</plugin>
stagingProgressTimeoutMinutes 默认为 5 min。
【参考文档】
https://help.sonatype.com/repomanager2/staging-releases/configuring-your-project-for-deployment