简体   繁体   English

声纳未拾取在詹金斯中运行Maven创建的三叶草测试结果

[英]Sonar not picking up clover test results created by running maven in jenkins

I've been working on this all day and haven't been able to find a solution, so thought i'd turn to the stackoverflow community. 我整天都在努力,还没有找到解决方案,所以以为我应该转向stackoverflow社区。

I have a server setup with Jenkins (version 1.454). 我使用Jenkins(版本1.454)进行服务器设置。 It's configured to perform the build with Maven (version 3.0.4). 它被配置为使用Maven(版本3.0.4)执行构建。 The build command is as follows: 构建命令如下:

clean clover2:setup verify clover2:aggregate clover2:clover

Jenkins has the sonar plugin installed and configured. Jenkins已安装并配置了声纳插件。 My sonar install (version 3) is on a different server to jenkins. 我的声纳安装(版本3)与jenkins在不同的服务器上。 After the build is completed, i can see the results on sonar (the basics of the build). 构建完成后,我可以在声纳上看到结果(构建的基础知识)。

I have installed to sonar the clover plugin (sonar-clover-plugin-2.8.jar) manually by putting it into the 'extentions/plugins' folder. 我已经通过手动将三叶草插件(sonar-clover-plugin-2.8.jar)安装到声纳中,将其放入“扩展名/插件”文件夹中。 It appeared in sonar and I can configure it. 它出现在声纳中,我可以对其进行配置。 I put in the license, version (3.1.4) and sonar.clover.reportPath as "target\\site\\clover\\clover.xml". 我将许可证,版本(3.1.4)和sonar.clover.reportPath放入“ target \\ site \\ clover \\ clover.xml”中。

When I run the build, it is successful as before, and I can see the basic results as before in Sonar, however, I cannot see any test code coverage results. 当我运行构建时,它像以前一样成功,并且在Sonar中可以像以前一样看到基本结果,但是,我看不到任何测试代码覆盖率结果。 When I look at the maven build output I notice the following: 当我查看Maven构建输出时,我注意到以下内容:

[INFO] Writing report to '/opt/jenkins/jobs/foo/workspace/target/site/clover/clover.xml'

and then near the bottom of the output: 然后靠近输出的底部:

[INFO] [15:08:36.586] Clover XML report not found

The following are also in my pom: 以下也是我的pom:

        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.clover.reportPath>target\site\clover\clover.xml</sonar.clover.reportPath>
    <sonar.surefire.reportsPath>target\surefire-reports</sonar.surefire.reportsPath>
    <sonar.core.codeCoveragePlugin>clover</sonar.core.codeCoveragePlugin>
    <sonar.clover.version>${clover.version}</sonar.clover.version>

When I look on the jenkins box, I can see that it has generated the clover.xml file (infact in my fiddling I have the clover plugin working on jenkins, so i can see the results there!). 当我查看jenkins框时,我可以看到它已经生成了clover.xml文件(实际上,我有四叶草插件正在jenkins上工作,所以我可以在那里看到结果!)。

I'm guessing at this stage that there is some issue with jenkins and sonar being on seperate boxes. 我猜在这个阶段,詹金斯和声纳在单独的盒子上存在一些问题。 Any help would be appreciated! 任何帮助,将不胜感激!

Cheers. 干杯。

After a lot more fiddling around, it appeared that I needed to change the following: 经过更多的摆弄之后,看来我需要更改以下内容:

<sonar.clover.reportPath>${project.build.directory}/site/clover/clover.xml</sonar.clover.reportPath>
    <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>

A good reference was the following: all about pom variables 以下是一个很好的参考: 所有关于pom变量

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

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