On demand jacoco tcp dump

Is there an easy way of dumping jacoco coverage data from a tcp agent on demand? IE, have a task which will pull the data from the server via the ant jacoco:dump? I can’t seem to get this working.

I figured it out… i did something like below… but there is probably a groovier way to do this… ?


    jacocoAnt 'org.jacoco:org.jacoco.ant:0.7.5+'

task dumpJacoco {
    ant {
	taskdef(name: 'dump',
		classname: 'org.jacoco.ant.DumpTask',
		classpath: configurations.jacocoAnt.asPath)
        dump(address: 'server.com',
        	destfile: "$buildDir/jacoco.exec")