【问题标题】:Is there a way to control the Jenkins failure reason? (It's failing because of a Maven plug-in problem)有没有办法控制詹金斯失败的原因? (由于 Maven 插件问题而失败)
【发布时间】:2020-10-13 06:17:00
【问题描述】:

我所有的测试都通过了。 但是,这就是我在 Jenkins 中构建失败的原因:

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar
(default-jar) on project my-project-tests: Execution default-jar of goal 
org.apache.maven.plugins:maven-jar-plugin:2.4:jar failed: 
Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one 
of its dependencies could not be resolved:
Failed to collect dependencies at 
org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> org.apache.maven:maven-archiver:jar:2.5:
Failed to read artifact descriptor for org.apache.maven:maven-archiver:jar:2.5:
Could not transfer artifact 
org.apache.maven:maven-archiver:pom:2.5 from/to company-artifactory 
(http://company.jfrog.io/company/company-maven-mirror): Not authorized -> [Help 1]

有没有办法用这个错误配置 Jenkinsfile 以 BUILD SUCCESS 结束?

【问题讨论】:

  • 存在权限问题http://company.jfrog.io/company/company-maven-mirror): Not authorized -!与其他事情无关。除此之外使用非常旧的插件版本...

标签: java maven jenkins groovy continuous-integration


【解决方案1】:

您可以使用currentBuild.result = "SUCCESS/UNSTABLE/FAILURE" 控制构建的结果,并在错误块周围尝试/捕获块(有关更多信息,请参阅there

但是我认为你应该解决这个 maven 问题。查看日志,您似乎试图在没有适当授权的情况下访问工件。此外,这个神器看起来像是一个假的(company.jfrog.io/company/company-maven-mirror?)。也许这是您项目中的复制/粘贴问题。

因此,如果此工件存在,请询问凭据,如果不存在,则可能将其从 pom.xml 中删除

【讨论】:

  • 谢谢,听起来不错。我写的是公司名称而不是我的公司名称(;
猜你喜欢
  • 2023-03-31
  • 2020-12-16
  • 2012-11-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-12
  • 2017-06-24
  • 1970-01-01
相关资源
最近更新 更多