Harish
(Harish Challa)
May 11, 2020, 2:21pm
1
Hi Morning,
I am using below for my sonar-jacoco-coverage but it always show 0%
https://cp4d-sonarqube.svl.ibm.com/sonar
SonarQube™ technology is powered by SonarSource SA
Enterprise Edition
Version 8.2 (build 32929)
sonar-jacoco-plugin-1.1.0.898.jar
sonarqube-ant-task-2.6.0.1426.jar
sonar-scanner-cli-4.0.0.1744.jar
when i run analysis i see all the results…but the coverage always shows 0%.
i am using ant java project for my product.
earlier for community edition it was showing. Recently we moved to enterprise edition when we moved only scanning or analysis is done but not the coverage.
have also attached the build.xml file to show the property used for our project.
pls help me on this.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Execute SonarScanner for Ant Analysis -->
<sonar:sonar/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/jacocoant.jar" />
</taskdef>
Must-share information (formatted with Markdown ):
which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
what are you trying to achieve
what have you tried so far to achieve thislogs.txt (455.1 KB)
Harish
(Harish Challa)
May 11, 2020, 5:28pm
2
can anyone pls help on this issue
Harish
(Harish Challa)
May 13, 2020, 4:55pm
3
can anyone pls help on this issue
ganncamp
(G Ann Campbell)
May 13, 2020, 6:19pm
4
Hi,
From your initial Ant excerpt, I don’t see where you’re generating the coverage report, and more importantly where you’re passing it in to analysis.
HTH,
Ann
P.S. Don’t forget that this is a community made up of people who come to help others out in their spare time. Sometimes you luck out and get an answer quickly, but that’s the exception rather than the rule.
Harish
(Harish Challa)
June 2, 2020, 9:16am
5
pls find the paramters
<!-- Execute SonarScanner for Ant Analysis -->
<sonar:sonar/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="/root/jacoco/lib/jacocoant.jar" />
</taskdef>
Harish
(Harish Challa)
June 2, 2020, 9:18am
6
i also tried using below
still coverage showing 0%
ganncamp
(G Ann Campbell)
June 2, 2020, 4:36pm
7
Hi,
Once you figure out how to generate the coverage report , you’ll need to pass it in to analysis. According to the docs , the property for that is sonar.coverage.jacoco.xmlReportPaths
.
Also, it looks like you need to review the SonarScanner for Ant docs for how to analyze with Ant.
Ann
Harish
(Harish Challa)
June 18, 2020, 5:05pm
8
Hi Ann,
apologies for the late reply…
my ant issue got fixed.
but code coverage still shows 0%
!-- Define the SonarQube project properties -->
<property name="sonar.projectKey" value="XXXXXX" />
<property name="sonar.projectName" value="XXXXX" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.sources" value="src" />
<property name="sonar.tests" value="test" />
<property name="sonar.java.binaries" value="jacoco_instrumented" />
<property name="sonar.java.test.binaries" value="test_bin" />
<property name="sonar.java.libraries" value="lib/*.jar" />
<property name="sonar.java.test.libraries" value="dist/*.jar" />
<property name="sonar.dynamicAnalysis" value="reuseReports" />
<property name="sonar.java.coveragePlugin" value="jacoco" />
<property name="sonar.java.source" value="1.7" />
<property name="sonar.coverage.exclusions" value = "**/*.html,**/*.css,**/*.png,**/*.jpg,**/*.JPG" />
<!-- <property name="sonar.jacoco.reportPaths" value="/root/git/liger-solserver-service/ilg-sol-workflow/jacoco.exec" /> -->
<property name="sonar.coverage.jacoco.xmlReportPaths" value="/root/git/liger-solserver-service/ilg-sol-workflow/report/jacoco-report.xml" />
<property name="sonar.junit.reportPaths" value="/root/git/liger-solserver-service/ilg-sol-workflow/report" />
<!-- Define SonarScanner for Ant Target -->
<target name="sonar">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<!-- Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
<classpath path="lib/sonarqube-ant-task-2.6.0.1426.jar" />
</taskdef>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/jacocoant.jar" />
</taskdef>
<!-- Execute SonarScanner for Ant Analysis -->
<sonar:sonar/>
</target>
when i run target ant build.xml sonar
dont see any error…
ganncamp
(G Ann Campbell)
June 19, 2020, 12:23pm
9
Hi,
It looks like you’re providing absolute paths to your reports. Try making them relative from project root.
Ann
Harish
(Harish Challa)
July 6, 2020, 5:10pm
10
Hi,
i tried with relative path but still the same issue
ganncamp
(G Ann Campbell)
July 7, 2020, 5:15pm
11
Hi,
Please provide a code-formatted (```
on the line before and on the line after) excerpt of your analysis log showing where the report is being read.
Ann