Ich benutze Ant, Jacoco und Sonar. Wenn ich mein Build starte, sagt mir Sonar, dass "keine Informationen über die Abdeckung pro Test vorliegen." und das Echolot-Dashboard hat meine Coverage-Ergebnisse, aber ich kann nicht in sie hineingehen, um den Code zu sehen. Der von Jacoco generierte HTML-Bericht enthält jedoch einen Drilldown in den Code. Dies ist meine Deckung Aufgabe:
"Keine Informationen zur Abdeckung pro Test." von Sonar mit Jacoco Ant Build
<jacoco:coverage destfile="${coverage.output.file}" >
<junit printsummary="on"
errorProperty="test.failed"
failureProperty="test.failed"
haltonfailure="yes"
fork="true">
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<classpath>
<path refid="test.build.class.path"/>
<pathelement location="${test.bin.dir}"/>
</classpath>
<batchtest todir="${results.dir}">
<fileset dir="${test.bin.dir}">
<include name = "**/**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<jacoco:report>
<executiondata>
<file file="${coverage.output.file}"/>
</executiondata>
<structure name="${ant.project.name}">
<classfiles>
<fileset dir="${bin.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}"/>
</sourcefiles>
</structure>
<html destdir="${coverage.results.dir}"/>
</jacoco:report>
</target>
Und mein Sonar Ziel sieht wie folgt aus:
<target name="sonar" depends = "run">
<property name="sonar.jdbc.url" value="..." />
<property name="sonar.jdbc.username" value="...r" />
<property name="sonar.jdbc.password" value="..." />
<property name="sonar.projectKey" value="org.codehaus.sonar:example-java-ant" />
<property name="sonar.projectName" value="${ant.project.name} (ant)" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.language" value="java" />
<property name="sonar.sources" value="${src.dir}" />
<property name="sonar.binaries" value="${bin.dir},${test.bin.dir}" />
<property name="sonar.libraries" value="${lib.dir}/*.jar" />
<property name="sonar.dynamicAnalysis" value="reuseReports" />
<property name="sonar.surefire.reportsPath" value="${results.dir}" />
<property name="sonar.java.coveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPath" value="${coverage.output.file}" />
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath>
<fileset dir="${lib.dir}" includes="sonar-ant-task-2.0.jar"/>
</classpath>
</taskdef>
<sonar:sonar />
</target>
Weiß jemand, was ich vermisst?
Ich bestätige - in meinem Fall wurde dies eingestellt, um Quellen zu testen, während es auf die kompilierten Klassen zeigen sollte. –
Ich habe versucht, die Eigenschaft sonar.tests hinzuzufügen, um sowohl auf Quellcode als auch auf Bytecode zu verweisen. Keine funktionierte. Ich bin immer noch damit ratlos. –
Ich habe das gleiche Problem. Ich denke, dass dies ein Fehler mit der Ant-Aufgabe sein könnte, da ich dies mit Sonar Runner getan hatte und es funktionierte gut, aber die gleichen Eigenschaften in Ant scheitern. – rozner