Index: trunk/build.xml
===================================================================
--- trunk/build.xml	(revision 6121)
+++ trunk/build.xml	(revision 6133)
@@ -8,7 +8,6 @@
 **   https://josm.openstreetmap.de/wiki/CreateBuild
 **
-**
 -->
-<project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir=".">
+<project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
     <property name="test.dir" location="test"/>
     <property name="src.dir" location="src"/>
@@ -30,7 +29,7 @@
 
     <!--
-	  ** Used by Eclipse ant builder for updating
-	  ** the REVISION file used by JOSM
-	-->
+      ** Used by Eclipse ant builder for updating
+      ** the REVISION file used by JOSM
+    -->
     <target name="create-revision-eclipse">
         <property name="revision.dir" value="bin"/>
@@ -38,6 +37,6 @@
     </target>
     <!--
-	  ** Creates the REVISION file to be included in the distribution
-	  -->
+      ** Creates the REVISION file to be included in the distribution
+    -->
     <target name="create-revision">
         <property name="revision.dir" value="${build.dir}"/>
@@ -169,4 +168,5 @@
         <delete dir="${test.dir}/build"/>
         <delete dir="${test.dir}/report"/>
+        <delete file="${test.dir}/jacoco.exec" />
     </target>
     <target name="test-compile" depends="test-init,dist">
@@ -181,19 +181,22 @@
     </target>
     <target name="test" depends="test-compile">
-        <junit printsummary="yes">
-            <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
-            <sysproperty key="java.awt.headless" value="true"/>
-	    <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
-            <classpath>
-                <path refid="test.classpath"/>
-                <pathelement path="${test.dir}/build"/>
-                <pathelement path="${test.dir}/config"/>
-            </classpath>
-            <formatter type="plain"/>
-            <formatter type="xml"/>
-            <batchtest fork="yes" todir="${test.dir}/report">
-                <fileset dir="${test.dir}/unit" includes="**/*.java"/>
-            </batchtest>
-        </junit>
+        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
+        <jacoco:coverage destfile="${test.dir}/jacoco.exec">
+            <junit printsummary="yes" fork="true" forkmode="once">
+                <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
+                <sysproperty key="java.awt.headless" value="true"/>
+            <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
+                <classpath>
+                    <path refid="test.classpath"/>
+                    <pathelement path="${test.dir}/build"/>
+                    <pathelement path="${test.dir}/config"/>
+                </classpath>
+                <formatter type="plain"/>
+                <formatter type="xml"/>
+                <batchtest fork="yes" todir="${test.dir}/report">
+                    <fileset dir="${test.dir}/unit" includes="**/*.java"/>
+                </batchtest>
+            </junit>
+        </jacoco:coverage>
     </target>
     <target name="test-html" depends="test" description="Generate HTML test reports">
@@ -205,4 +208,19 @@
             <report todir="${test.dir}/report/html"/>
         </junitreport>
+        <jacoco:report>
+            <executiondata>
+                <file file="${test.dir}/jacoco.exec"/>
+            </executiondata>
+            <structure name="JOSM Test Coverage">
+                <classfiles>
+                    <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
+                </classfiles>
+                <sourcefiles encoding="UTF-8">
+                    <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
+                </sourcefiles>
+            </structure>
+            <!--<xml destfile="${test.dir}/report/jacoco.xml"/>-->
+        	<html destdir="${test.dir}/report/jacoco"/>
+        </jacoco:report>
     </target>
     <target name="dist-optimized" depends="dist">
@@ -245,5 +263,5 @@
 		# Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'. This notes should not be a problem as we don't use obfuscation
 		-dontnote
-		</proguard>
+        </proguard>
     </target>
     <target name="check-plugins" depends="dist-optimized">
@@ -285,27 +303,27 @@
                 </tokenfilter>
             </filterchain>
-        </loadresource>	
-	<!-- Delete files that are not in plugin list (like old plugins) -->
-	<loadresource property="file-list">
-	  <propertyresource name="plugins"/>
-	  <filterchain>
-	    <tokenfilter>
-	      <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
-            </tokenfilter>
-	    <striplinebreaks/>
-	    <tokenfilter>
-	      <replaceregex pattern="\|$" replace="" flags="gi"/>
-            </tokenfilter>	    
-	  </filterchain>
-	</loadresource>
-	<delete>
-	  <restrict>
-	    <fileset dir="${dir}"/>
-	    <not>
-	      <name regex="${file-list}"/>
-	    </not>
-	  </restrict>
-	</delete>
-	<!-- Download plugins -->
+        </loadresource>
+        <!-- Delete files that are not in plugin list (like old plugins) -->
+        <loadresource property="file-list">
+            <propertyresource name="plugins"/>
+            <filterchain>
+                <tokenfilter>
+                    <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
+                </tokenfilter>
+                <striplinebreaks/>
+                <tokenfilter>
+                    <replaceregex pattern="\|$" replace="" flags="gi"/>
+                </tokenfilter>    
+            </filterchain>
+        </loadresource>
+        <delete>
+            <restrict>
+                <fileset dir="${dir}"/>
+                <not>
+                    <name regex="${file-list}"/>
+                </not>
+            </restrict>
+        </delete>
+        <!-- Download plugins -->
         <copy todir="${dir}" flatten="true">
             <resourcelist>
@@ -320,5 +338,5 @@
                 <fileset file="${java.home}/lib/jce.jar"/>
             </path>
-        </as:build-signatures>	
+        </as:build-signatures>
         <as:check-signature signature="${dir}/api.sig">
             <ignore classname="org.jgraph.*"/>
@@ -337,5 +355,5 @@
 
     <target name="findbugs" depends="dist">
-    	<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
+        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
         <path id="findbugs-classpath">
             <fileset dir="tools/findbugs/">
@@ -343,15 +361,15 @@
             </fileset>
         </path>
-    	<property name="findbugs-classpath" refid="findbugs-classpath"/>
-      <findbugs output="xml"
+        <property name="findbugs-classpath" refid="findbugs-classpath"/>
+        <findbugs output="xml"
                 outputFile="findbugs-josm.xml"
-      	        classpath="${findbugs-classpath}"
-      	        pluginList=""
-      	        excludeFilter="tools/findbugs/josm-filter.xml"
-      	        effort="max"
-      	        >
-        <sourcePath path="${basedir}/src" />
-        <class location="${basedir}/dist/josm-custom.jar" />
-      </findbugs>
+                classpath="${findbugs-classpath}"
+                pluginList=""
+                excludeFilter="tools/findbugs/josm-filter.xml"
+                effort="max"
+                >
+            <sourcePath path="${basedir}/src" />
+            <class location="${basedir}/dist/josm-custom.jar" />
+        </findbugs>
     </target>
     <target name="run" depends="dist">
