[英]Jenkins Sonar Scanner vs Maven sonar:sonar goal
I tried running a sonar analysis using a java project on Jenkins using the standard maven sonar:sonar goal and also using the post step>> Execute SonarQube scanner. 我尝试使用标准的maven声纳:声纳目标并使用post step >> Execute SonarQube扫描仪在Jenkins上使用java项目运行声纳分析。 The maven goal I used is.
我使用的maven目标是。
clean org.jacoco:jacoco-maven-plugin:0.7.8:prepare-agent package org.jacoco:jacoco-maven-plugin:0.7.8:report sonar:sonar -Dmaven.test.failure.ignore=true
For SonarQube scanner I used the below maven goal 对于SonarQube扫描仪,我使用了以下maven目标
clean org.jacoco:jacoco-maven-plugin:0.7.8:prepare-agent package org.jacoco:jacoco-maven-plugin:0.7.8:report -Dmaven.test.failure.ignore=true
and in the Post step, I added Execute SonarQube scanner step. 在Post步骤中,我添加了Execute SonarQube扫描仪步骤。
Using maven sonar:sonar goal, I got 60% coverage and using the post step, I got only 49%. 使用maven声纳:声纳目标,我得到60%的覆盖率并使用后一步,我只有49%。 Not able to figure out the reason for the difference.
无法弄清楚差异的原因。
SonarQube version - 7.7 Sonar Scanner version - 3.3.0 Jenkins version - 2.164.3 Maven version - 3.6.1 SonarQube版本 - 7.7声纳扫描仪版本 - 3.3.0 Jenkins版本 - 2.164.3 Maven版本 - 3.6.1
I had mentioned sonar source directory different for both the runs. 我曾经提到两个运行的声纳源目录不同。 For maven, it was picked from pom.xml where it was src/main and for sonar scanner it was configured in the job as src.
对于maven,它是从pom.xml中选择的,它是src / main,对于声纳扫描器,它在作业中配置为src。 After changing it, the issue got resolved.
更改后,问题得到解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.