Jacoco ant task - no jacoco.exec output

1,313 views
Skip to first unread message

folk...@gmail.com

unread,
Apr 4, 2013, 7:44:58 AM4/4/13
to jac...@googlegroups.com
Hello Jacoco,

I recently switch from Maven to ANT for my project build.
My Jacoco task is configured as follows

<target name="test" depends="init">
<jacoco:coverage destfile="target/jacoco.exec">
<junit printsummary="yes" haltonfailure="yes" fork="yes" forkmode="once">
<classpath refid="my_project.path"/>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest fork="false" todir="target/test-reports">
<fileset dir="test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
</target>

Which produces the expected junit result. However, I was expecting the coverage task to create the target/jacoco.exec file. I could not find any output file from Jacoco. The coverage task seems to be executed as expected and do not encounter an error during the ant test report task execution:

test: [jacoco:coverage] Enhancing junit with coverage

...

[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,009 sec
report: [jacoco:report] Loading execution data file /home/usr/Workspaces/my_project/target/jacoco.exec

BUILD FAILED /home/usr/Workspaces/my_project/build.xml:73: Unable to read execution data file /home/usr/Workspaces/my_project/target/jacoco.exec

Total time: 14 seconds

Seems like I am missing something, unable to see what exactly.

folk...@gmail.com

unread,
Apr 4, 2013, 8:03:08 AM4/4/13
to jac...@googlegroups.com
It seems to me that the wrapper is executing just fine but fails to output the result file. I tried to find more information about the cause using ANT verbose and debug parameters but there was no mention of jacoco.exec.

folk...@gmail.com

unread,
Apr 4, 2013, 9:14:50 AM4/4/13
to jac...@googlegroups.com
It was the batchtest fork="false" that was causing the problem. It has to be set to fork="true".
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages