简体   繁体   English

詹金斯:工作页边栏上缺少SonarQube链接

[英]Jenkins: SonarQube link missing from job page's side bar

In the past, I configured Sonar in Jenkins by doing "Add post-build action -> SonarQube". 在过去,我通过“添加后构建操作 - > SonarQube”在Jenkins中配置了Sonar。

Now, when I do so, I get this warning: 现在,当我这样做时,我收到了这个警告:

It is no longer recommended to use SonarQube maven builder. 不再建议使用SonarQube maven builder。 It is preferable to set up SonarQube in the build environment and use a standard Jenkins maven target. 最好在构建环境中设置SonarQube并使用标准的Jenkins maven目标。

To fix this, I use this Maven plugin 要解决这个问题,我使用这个Maven插件

<plugin>
    <groupId>org.sonarsource.scanner.maven</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>3.0.1</version>
</plugin>

and in the Jenkins job, I execute the following goals 在詹金斯的工作中,我执行了以下目标

-U clean test site sonar:sonar -Dsonar.host.url=http://my-sonar-server

Everything works flawlessly, except that the SonarQube link is missing from the side bar in the job page. 除了作业页面中的侧栏中缺少SonarQube链接外,一切都完美无瑕。

When I check the log, I see the SonarQube link:- 当我查看日志时,我看到了SonarQube链接: -

[INFO] Analysis report generated in 162ms, dir size=52 KB
[INFO] Analysis reports compressed in 47ms, zip size=27 KB
[INFO] Analysis report uploaded in 81ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://my-sonar-server/dashboard/index/org.project.test:test-webapp-war
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://my-sonar-server/api/ce/task?id=AVJgoenzoxKSuOBz_89b
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:46 min
[INFO] Finished at: 2016-01-20T14:02:50-06:00
[INFO] Final Memory: 67M/309M
[INFO] ------------------------------------------------------------------------

It appears I can add do "Add build step -> Invoke Standalone SonarQube Analysis", which will make this SonarQube link to appear, but it requires me to specify all the analysis properties manually and I find that very tedious since the sonar-maven-plugin handles that seamlessly for me. 看来我可以添加“添加构建步骤 - >调用独立的SonarQube分析”,这将使这个SonarQube链接出现,但它需要我手动指定所有分析属性,我发现自sonar-maven-plugin非常繁琐sonar-maven-plugin为我无缝处理。

My question is, using sonar-maven-plugin and my given goals above, how do I force Jenkins to display the SonarQube link on the job page's side bar? 我的问题是,使用sonar-maven-plugin和我上面给出的目标,我如何强制Jenkins在作业页面的侧栏上显示SonarQube链接?

I'm using Jenkins 1.645 and SonarQube 5.3. 我正在使用Jenkins 1.645和SonarQube 5.3。

你只需简单地勾选上构建配置侧边栏链接选项,如图这里 ,把声纳扫描链接到您的项目。

  • Go to Manage Jenkins > Global Configuration 转到管理Jenkins>全局配置
  • Check "Enable injection of Sonarqube server configuration as build environment variable" inside 选中“在内部启用Sonarqube服务器配置注入为构建环境变量”
  • Check "Prepare SonarQube Scanner environment" under Build Environment of the project configuration page 在项目配置页面的构建环境下选中“准备SonarQube扫描仪环境”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM