jacoco - Gradle JacocoReport task triggers confusing Exception -
i'm trying generate merged jacoco test coverage reports in non-standard multi-project gradle setup. in following gradle code 2 tasks. first one, jacocomerge, works (after struggling), generating combined.exec file in right place. second task, jacocomergedreport seems executed without error according log traces, nothing, , there's null pointer exception in trace shortly after execution.
here's gradle fragment:
afterevaluate { task jacocomerge(type: jacocomerge) { executiondata testtasks destinationfile = file("$builddir/../reports/combined.exec") executiondata = files(executiondata.findall({ it.exists() })) jacococlasspath = cp } task jacocomergedreport(type: org.gradle.testing.jacoco.tasks.jacocoreport, dependson: 'jacocomerge') { jacococlasspath = cp executiondata = files("$builddir/../reports/combined.exec") sourcedirectories = files(subprojects.findall { isactualproject(it) }.sourcesets.main.allsource.srcdirs).filter({it.exists()}) classdirectories = files(subprojects.findall { isactualproject(it) }.sourcesets.main.output).filter({it.exists()}) reports { html.enabled = true xml.enabled = true csv.enabled = true } executiondata.each {println it} } }
i have verified inputs , gradle version (2.14 - running wrapper launched via eclipse) println
statements, , looks me.
but generates nothing besides, apparently, null pointer exception :
java.lang.nullpointerexception @ org.gradle.api.internal.project.taskfactory.outputdirectorypropertyannotationhandler$1.validate(outputdirectorypropertyannotationhandler.java:49)
the full stack trace , encouraging lifecycle messages jacocomergedreport task precede error available in pastebin file.
i looked @ source code on github class, oddly line number , method name seem correspond an earlier version of gradle 2.14.
so causes error, and, secondarily, why gradle tells me version 2.14 stack trace seems correspond code earlier version , not last committed before 2.14 build time (2016-06-14 07:16:37 utc, according build log)?
i have resolved issue, apart question gradle version. reason report destination directories not being set default values, able working tweaking reports follows:
reports { html.enabled = true xml.enabled = true csv.enabled = true } getreports().getxml().setdestination(file("$builddir/../reports/jacoco/merged.xml")) getreports().getcsv().setdestination(file("$builddir/../reports/jacoco/merged.csv")) getreports().gethtml().setdestination(file("$builddir/../reports/jacoco/html"))
Comments
Post a Comment