From: Christian J. <chr...@bw...> - 2010-03-17 09:41:09
|
Hi I'm having trouble generating HTML reports with the Ant task cobertura-report with Ant 1.8.0, JDK 1.6.0_17 and Cobertura-1.9.4.1 (also tried 1.9.3) My code looks like this <macrodef name="m_cobertura-init"> <sequential> <taskdef resource="tasks.properties" classpathref="buildenv.lib.classpath" /> </sequential> </macrodef> <macrodef name="m_cobertura-report" description="Uses properties: src.java.dir, build.dir, coverage.report.dir."> <attribute name="cobertura.format" default="${cobertura.format}" /> <attribute name="cobertura.datafile" default="${cobertura.datafile}" /> <attribute name="cobertura.destdir" default="${cobertura.destdir}" /> <attribute name="cobertura.maxmemory" default="128" /> <attribute name="cobertura.srcdir" default="${cobertura.srcdir}" /> <sequential> <taskdef resource="tasks.properties" classpathref="buildenv.lib.classpath" /> <mkdir dir="@{cobertura.destdir}" /> <echo message="Generating Cobertura report using datafile @{cobertura.datafile}, todir=@{cobertura.destdir}." /> <cobertura-report format="@{cobertura.format}" datafile="@{cobertura.datafile}" destdir="@{cobertura.destdir}" maxmemory="@{cobertura.maxmemory}" srcdir="@{cobertura.srcdir}" /> </sequential> </macrodef> <target name="foobar" description=""> <m_cobertura-init /> <m_cobertura-report /> </target> When I run the foobar target I get the following result... $ time ant foobar Buildfile: /Users/me/Desktop/Archive/build.xml foobar: [echo] Generating Cobertura report using datafile /Users/me/Desktop/Archive/_BUILD/cobertura.ser, todir=/Users/me/Desktop/Archive/_DIST/reports/coverage/cobertura. [cobertura-report] The jvmargs attribute is deprecated. Please use nested jvmarg elements. [cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file [cobertura-report] Cobertura: Loaded information on 622 classes. [cobertura-report] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [cobertura-report] at java.util.Arrays.copyOfRange(Arrays.java:3209) [cobertura-report] at java.lang.String.<init>(String.java:215) [cobertura-report] at java.lang.StringBuffer.toString(StringBuffer.java:585) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateHtmlizedJavaSource(HTMLReport.java:638) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateSourceFile(HTMLReport.java:501) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateSourceFiles(HTMLReport.java:434) [cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.<init>(HTMLReport.java:97) [cobertura-report] at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:105) [cobertura-report] at net.sourceforge.cobertura.reporting.Main.main(Main.java:174) BUILD FAILED /Users/me/Desktop/Archive/build.xml:148: The following error occurred while executing this line: /Users/me/Desktop/Archive/_BUILDENV/cobuto/macros/cobertura.xml:52: Error running reports. See messages above. Total time: 16 seconds real 0m17.064s user 0m21.720s sys 0m0.879s Changing the report generation to XML format like this <target name="foobar" description=""> <m_cobertura-init /> <m_cobertura-report cobertura.format="xml" /> </target> yields the following result $ time ant foobar Buildfile: /Users/me/Desktop/Archive/build.xml foobar: [echo] Generating Cobertura report using datafile /Users/me/Desktop/Archive/_BUILD/cobertura.ser, todir=/Users/me/Desktop/Archive/_DIST/reports/coverage/cobertura. [cobertura-report] The jvmargs attribute is deprecated. Please use nested jvmarg elements. [cobertura-report] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file [cobertura-report] Cobertura: Loaded information on 622 classes. [cobertura-report] Report time: 26887ms BUILD SUCCESSFUL Total time: 28 seconds real 0m29.214s user 0m34.104s sys 0m1.133s When bypassing the Ant task cobertura-report and calling the Java class directly, like this <macrodef name="m_cobertura-report-java" description="Uses properties: src.java.dir, build.dir, coverage.report.dir."> <attribute name="cobertura.format" default="${cobertura.format}" /> <attribute name="cobertura.datafile" default="${cobertura.datafile}" /> <attribute name="cobertura.destdir" default="${cobertura.destdir}" /> <attribute name="cobertura.maxmemory" default="128" /> <attribute name="cobertura.srcdir" default="${cobertura.srcdir}" /> <sequential> <mkdir dir="@{cobertura.destdir}" /> <echo message="Generating Cobertura report using datafile @{cobertura.datafile}, todir=@{cobertura.destdir}." /> <echo message="NOT using Ant task" /> <java classname="net.sourceforge.cobertura.reporting.Main" classpathref="buildenv.lib.classpath"> <arg line="--destination @{cobertura.destdir} --basedir @{cobertura.srcdir} --datafile @{cobertura.datafile} --format @{cobertura.format}" /> <jvmarg value="-Xmx@{cobertura.maxmemory}m" /> </java> </sequential> </macrodef> <target name="foobar2" description=""> <m_cobertura-report-java /> </target> it yields the following result (Observe the difference in execution time!) $ time ant foobar2 Buildfile: /Users/me/Desktop/Archive/build.xml foobar2: [echo] Generating Cobertura report using datafile /Users/me/Desktop/Archive/_BUILD/cobertura.ser, todir=/Users/me/Desktop/Archive/_DIST/reports/coverage/cobertura. [echo] NOT using Ant task [java] JVM args ignored when same JVM is used. [java] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file [java] Cobertura: Loaded information on 622 classes. [java] Report time: 1257ms BUILD SUCCESSFUL Total time: 2 seconds real 0m2.997s user 0m3.739s sys 0m0.295s Am I doing something wrong? I tried experimenting with maxmemory attribute but it does not seem to affect anything? Another thing, why do I get the print out? "[cobertura-report] The jvmargs attribute is deprecated. Please use nested jvmarg elements." Cheers Christian Jendeberg bwin Games AB |