Execute task with build task
Add this to the end of your buildscript
build.dependsOn jacocoTestReport
I would suggest
build.finalizedBy(jacocoTestReport)
This way, the jacocoTestReport
task is only executed after the build task, as you specified. In the accepted answer, the build task depends on the test report task, which means build will be executed after your custom task.