Emma coverage report fail

Hi, I am having a weird issue where running code coverage report with emma. I have a multi project setup, I’m using a variation of the following code: http://git.springsource.org/spring-security/lukes-spring-security/blobs/5caa41753ad4d4139f1cf878d4aee7b5e24feed6/gradle/emma.gradle

all works fine when running: gradle test coverageReport -Pcoverage=on

but when running: gradle build coverageReport -Pcoverage=on

I am getting the following exception from the emma ant plugin: java.io.EOFException

at java.io.RandomAccessFile.readInt(RandomAccessFile.java:725)

at java.io.RandomAccessFile.readLong(RandomAccessFile.java:758)

at com.vladium.emma.data.DataFactory.mergeload(DataFactory.java:448)

The exception comes from emma and not gradle, so I know it’s not a gradle issue per se. but I can’t seem to find what makes the difference between running build or test in this use case.

My guess is that the emma file is corrupted in the later case, maybe some process still holds it open? but what can lead to such issue?

Hi, sorry for the late reply.

I’m also unsure why this is happening. Would you be able to put together a sample project exhibits this that I can use to found out what is going on?

I managed to workaround this issue by running the tasks explicitly, i.e: test build coverageReport

I know the test task is part of the build flow, but somehow it fixed my problem. I am still uncertain whether it’s an emma, gradle or my code who’s responsible for this issues.