Issue for generating jacoco report

I am trying to generate jacoco report for multiple subprojects, ‘adapter’, ‘application’, ‘domain’, ‘test’.

I have build.gradle for the root project as follows.

allprojects {
apply plugin: 'jacoco'
apply plugin: 'eclipse'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8

dependencyManagement {
    imports {
        mavenBom 'io.spring.platform:platform-bom:Brussels-RELEASE'
    }
}
jacoco {
	toolVersion = "0.7.6.201602180812"
}


def BUILDROOT = "C:/Works/coveragetest-master"


task jacocoMerge(type: JacocoMerge) {
    destinationFile = file("${buildDir}/jacoco/jacoco.exec")
	def subprojectsNames = [
		'adapter', 'application', 'domain', 'test'
	]
	def jacocoFiles = []
	jacocoFiles << file("${BUILDROOT}/adapter/build/jacoco/test.exec")
	jacocoFiles << file("${BUILDROOT}/application/build/jacoco/test.exec")
	jacocoFiles << file("${BUILDROOT}/domain/build/jacoco/test.exec")
	jacocoFiles << file("${BUILDROOT}/test/build/jacoco/test.exec")
	executionData = files(jacocoFiles)
}

task collectJacocoTestReport(type: JacocoReport) {
    dependsOn(jacocoMerge)


    reports {
        xml.enabled = true
        html.enabled = true
		html.destination "${buildDir}/reports/jacoco/html"
    }
	executionData = files('build/jacoco/jacoco.exec')
    additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
    sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
    classDirectories = files(subprojects.sourceSets.main.output)
    classDirectories = files(classDirectories.files.collect {
        fileTree(dir: it,
    	        exclude: ['**/io/grpc/okhttp/internal/**'])
    })
}

}

And here is the build.gradle for one of the subprojects.

apply plugin: "jacoco"

dependencies {
    compile project(":application")

    compile('org.springframework:spring-web')
	testCompile group: 'junit', name: 'junit', version: '4.+'
    testCompile('junit:junit')
    testCompile('org.mockito:mockito-core')
}

All the build.gradle files are simple for subprojects.

I am trying to merge all the reports into a single report based on the jacoco.exec generated from the subprojects.

When I execute “gradle clean build collectJacocoTestReport”, I see all the jacoco reports generated in the subproject/build/reports/jacoco and jacoco.exec and test.exec under subproject/build/jacoco. I don’t know why there are two exec files under subproject/build/jacoco. Anyway, it seems to merge into a single exec file, but it doesn’t generate rootproject/build\reports\jacoco\html.

Can anybody point out which part is wrong?

Thanks.