Please never anywhere share screenshots of text if you only want to share the text and not something additional like colors or IDE annotations. Text in images is hard to read, especially on mobile, very hard to copy, and nearly impossible to search for.
Besides that, your image and your text seem to be inconsistent, or that is the source of your problems.
In the image you say something about build.xml?!?
Also in the image you say the source is at src/... but then you say you configure your build to look in src/java for the sources!?!
Your main problem probabyl is, that you configure the classDirectories to be files in src, which seems to be wrong on multiple layers. I think you should be able to remove all the jacoco configuration below the reports block. As you configure the main source set with your path structure and that JaCoCo task should be configured to work with the main source set, it should just work.
src/ is a folder in the root directory, which has .java files, for these java files the .class files are being generated in one of the modules: moduleA/build/classes folder (this is done using build.xml)
but then you say you configure your build to look in src/java for the sources!?!
β as you can see the comment : //set to some non existing folders to avoid compiling root project (I know this not right, but canβt be changed at this point of time)
Here the java files in src/com/healthcare package are being compiled and .class files are generated in moduleAβs modules/moduleA/build/classes/java/main location, this is achieved using build.xmlβ¦
Tests for classes in src/com/healthcare are written in root directory test folder.
I am able to add the test folder as custom source set in root build.gradle.kts, but not able to get jacoco coverage, when I am adding jacoco config in root build.gradle files. its generating rootDirectory/build/jacoco/test.exe, but no report.
modules/moduleA/build.gradle.kts also has jacoco plugin, which is generating report for .class files of root src/com/healthcare package but its coming as zero coverage.
Hereβs is my jacoco config in root build.gradle.kts:
as you can see the comment : //set to some non existing folders to avoid compiling root project (I know this not right, but canβt be changed at this point of time)
Ah, sorry, I missed that comment.
But then at least set it to an empty list, instead of something non-existing, that is just confusing and still wastes time.
As this is a quite uncommon setup, I suggest you create an MCVE so that it is easier to talk concretely.
In absence of that, you set something that is called classDirectories to class files. Are you sure JaCoCo can handle that? I suspect this might be the cause of your issue. You might also get more insight when you run with --info or --debug to see what is given to what where.