Jenkins Sonar插件突然停止工作 [英] Jenkins Sonar plugin suddenly stops working

查看:164
本文介绍了Jenkins Sonar插件突然停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的Jenkins版本在一夜之间开始失败,并显示以下错误:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project <project>: 
Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar failed: 
Unable to load the mojo 'sonar' in the plugin 'org.codehaus.mojo:sonar-maven-plugin:2.7' due to an API incompatibility:
org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/codehaus/mojo/sonar/SonarMojo :
Unsupported major.minor version 51.0

Jenkins服务器仍在运行Java 6,但我们没有做任何更改.

发生了什么事,我们该如何解决?

解决方案

jenkins-sonar-插件使用 sonar-maven-plugin 进行声纳分析. >

Sonar-maven-plugin已于2015-10-19更新至2.7,新版本与Java 6不兼容.

Jenkins-sonar-plugin默认使用最新版本的sonar-maven-plugin,但是您可以覆盖它.

因此,要纠正该错误,请打开管理Jenkins"/配置系统",找到声纳"部分,单击高级",然后在声纳-maven-插件版本"中输入2.6.这迫使jenkins-sonar-plugin使用与Java 6兼容的早期版本的sonar-maven-plugin.

或者,如果您只想为一个特定的Jenkins作业设置2.6,则可以强制Maven使用目标org.codehaus.mojo:sonar-maven-plugin:2.6:sonar而不是标准sonar:sonar使用2.6版本.

还:开始计划将构建服务器升级到Java 7或Java 8.

Our Jenkins builds started failing overnight with the error:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project <project>: 
Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar failed: 
Unable to load the mojo 'sonar' in the plugin 'org.codehaus.mojo:sonar-maven-plugin:2.7' due to an API incompatibility:
org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/codehaus/mojo/sonar/SonarMojo :
Unsupported major.minor version 51.0

The Jenkins server is still running Java 6, but we did not change anything.

What happened and how do we fix it?

解决方案

The jenkins-sonar-plugin uses sonar-maven-plugin to run the Sonar analysis.

Sonar-maven-plugin was updated to 2.7 on 2015-10-19 and the new version is not compatible with Java 6.

Jenkins-sonar-plugin uses the latest version of sonar-maven-plugin per default, but you can override this.

So to fix the error, open "Manage Jenkins"/"Configure System", find the Sonar section, click advanced and enter 2.6 in "Version of sonar-maven-plugin". This forces jenkins-sonar-plugin to use the previous version of sonar-maven-plugin, which works with Java 6.

Alternatively, if you want to set 2.6 only for one specific Jenkins job then you can force maven to use 2.6 version using goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar instead of standard sonar:sonar.

Also: begin planning to upgrade the build server to Java 7 or Java 8.

这篇关于Jenkins Sonar插件突然停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆