title: How do I get a Jacoco coverage report using gradle plugin when all my tests are in a separate submodule
body: <p>I'm having trouble setting up jacoco coverage for my java project since I'm new to gradle. My final goal is to connect this to sonarqube. All my tests are in a separate module</p>
  <p>structure:</p>
  <pre><code>./build.gradle
  settings.gradle
  
  ./submodule1/build.gradle
  ./submodule1/src/main/java/prismoskills/Foo.java
  
  ./submodule2/build.gradle
  ./submodule2/src/main/java/com/project/prismoskills/Bar.java
  
  ./test/build.gradle
  ./test/src/test/java/prismoskills/TestFooBar.java
  </code></pre>
  <p>One way I can think of is to set <strong>additionalSourceDirs</strong> in test module  and enable jacoco only in root and test module.</p>
  <p>The problem with this approach is that my project has a lot of sub modules(which I haven't shown here) and I am having trouble passing additionalsourcedirs to test module's JacocoReport task in an automated way.</p>
  <p>Also it looks like this use case can be handled in maven easily by referring to this
  <a href="https://prismoskills.appspot.com/lessons/Maven/Chapter_06_-_Jacoco_report_aggregation.jsp" rel="nofollow noreferrer">https://prismoskills.appspot.com/lessons/Maven/Chapter_06_-_Jacoco_report_aggregation.jsp</a></p>
  <p>Any leads on how to proceed further with gradle will be appreciated. Thanks in advance</p>
  <pre><code>gradle version: 6.4
  jacoco gradle plugin version: 0.8.5
  </code></pre>