Execute a task in gradle just before Test Executor ends

459 views Asked by At

I want to run a ant target which will dump the jacoco coverage data from localhost:6300 (Jacoco is setup as javaagent with options: output=tcpserver,address=*,port=6300). The ant target is a client which will be called after running the tests to dump coverage data to a file. I used the following:

test.finalizedBy(antjacocoReport)

antjacocoReport is the ant target which is executing fine, but since the Gradle Test Executor exits before this task, it is showing

[ant:jacoco:dump] Connecting to localhost/127.0.0.1:6300
[ant:jacoco:dump] Connection refused: connect

and

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':antjacocoReport'.
> Unable to dump coverage data

Anyone has any idea how to accomplish this task before gradle exhaust's the jacoco agent. ?

0

There are 0 answers