Jacoco don't show coverage in sonar ant scanner

this is the part in the build.xml where I use jacoco coverage

	<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
		
			<classpath path="${basedir}/hybris/bin/platform/apache-ant/lib/" />
		
	</taskdef>

	<!-- Import the JaCoCo Ant Task -->
	<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
		<classpath path="${basedir}/hybris/bin/platform/apache-ant/lib/jacocoant.jar" />
	</taskdef>

	<!-- Run your unit tests, adding the JaCoCo agent -->
	<jacoco:coverage destfile="${basedir}/target/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant" exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
		<junit fork="true" dir="${basedir}" failureProperty="test.failed">
			<classpath location="${classes.dir}" />
			<classpath refid="classpath" />

			<formatter type="xml" />
			<batchtest fork="yes" todir="${reports.junit.xml.dir}">
				<fileset dir="${claroordermanagement.sonar.test.dir}">					
					<include name="**/*Test.java" />
				</fileset>
				<fileset dir="${clarowebservices.sonar.test.dir}">
					<include name="**/*Test.java" />
				</fileset>
				<fileset dir="${clarocore.sonar.test.dir}">
					<include name="**/*Test.java" />
				</fileset>
				<fileset dir="${clarofacades.sonar.test.dir}">
					<include name="**/*Test.java" />
				</fileset>

				<fileset dir="${clarob2ctelcoaddon.sonar.test.dir}">
					<include name="**/*Test.java" />
				</fileset>
				<fileset dir="${clarostorefront.sonar.test.dir}">
					<include name="**/*Test.java" />
				</fileset>
			</batchtest>
		</junit>
	</jacoco:coverage>
	
</target>

<!-- Define the Sonar target -->

<target name="sonar">
	<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
		<!-- Update the following line, or put the "sonar-ant-task-*.jar" file
            in your "$HOME/.ant/lib" folder -->
		<classpath path="${basedir}/hybris/bin/platform/apache-ant/lib/" />
	</taskdef>

	<!-- Execute Sonar -->
	<sonar:sonar />
</target>

Hi,

Welcome to the community!

You may find the SonarScanner for Ant docs helpful, as well as the test-related analysis parameters.

 
Ann