Java 声纳 Cobertura 插件未找到coverage.xml 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24134595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sonar Cobertura Plugin not finding coverage.xml file
提问by user3472205
I have a multi-module maven project in Jenkins
1.545.I am using Sonarqube
version 4.2.I have installed cobertura
plugin version 1.6.1 and java
plugin version 2.2.1 in Sonarqube
.I have successfully generated coverage.xml
file at location- /target/site/cobertura/coverage.xml
for each module using maven command- "cobertura:cobertura -Dcobertura.report.format=xml"
For sonar,i have set the maven build option as sonar:sonar
with properties as below:
我在Jenkins
1.545 中有一个多模块 maven 项目。我使用的是4.2Sonarqube
版。我已经安装了cobertura
1.6.1java
版插件和2.2.1版插件Sonarqube
。我已经coverage.xml
在位置成功生成了文件 -/target/site/cobertura/coverage.xml
使用 maven 命令为每个模块 -"cobertura:cobertura -Dcobertura.report.format=xml"
对于声纳,我已将 maven 构建选项设置为sonar:sonar
具有如下属性:
sonar.dynamicAnalysis=reuseReports
sonar.junit.reportsPath=target/site
sonar.java.coveragePlugin=cobertura
sonar.cobertura.reportPath=/target/site/cobertura/coverage.xml
I can see coverage.xml
file when I browse the workspace of my project in Jenkins
but the plugin keeps saying that it can't find it.I get the following message in console output of jenkins-
我coverage.xml
在浏览项目的工作区时可以看到文件,Jenkins
但插件一直说找不到它。我在 jenkins 的控制台输出中收到以下消息-
Execute Findbugs 2.0.3 done: 48446 ms
Sensor FindbugsSensor done: 48800 ms
Sensor CoberturaSensor...
Cobertura report not found at /target/site/cobertura/coverage.xml
Sensor CoberturaSensor done: 4 ms
Sensor CpdSensor...
Any help is appreciated.Thanks in advance.
任何帮助表示赞赏。提前致谢。
回答by user2806909
I had the same issue (SonarQube 4.4., Cobertura 1.6.2, Jenkins + maven + java8) and I just finally figured out solution for the problem:
我遇到了同样的问题(SonarQube 4.4.、Cobertura 1.6.2、Jenkins + maven + java8),我终于找到了解决问题的方法:
sonar.cobertura.reportPath=target/site/cobertura/coverage.xml
Notice the missing "/" from the beginning of the path!
注意路径开头缺少的“/”!
It actually tried to search from absolute root directory in my Linux server.
它实际上试图从我的 Linux 服务器中的绝对根目录进行搜索。