E.g. my approach is using this https://gist.github.com/maggandalf/3124339 
to generate the reports.

Perhaps that's not the best way as we are effectively using ANT instead of 
Maven to generate the reports yet the Maven plugin is configured like this:

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>

It's a pretty confusing setup over all.
On Friday, September 8, 2023 at 8:34:26 AM UTC-6 David Hoffer wrote:

> I tried getting it from that link but I can't view what versions are there 
> as directory listing is disabled.
>
> The problem is we have a multi module Maven building using JDK17 and we 
> have configured JaCoCo to generate a consolidated code coverage report.  
> I'm using an approach I found on the web that involves coping this:
>
> <groupId>org.jacoco</groupId>
> <artifactId>org.jacoco.ant</artifactId>
>
> To each of the modules and then it uses:
>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
>
> With a target configured like this:
> <target>
> <!-- Execute an ant task within maven -->
> <echo message="Generating JaCoCo Reports"/>
> <taskdef name="report" classname="org.jacoco.ant.ReportTask">
> <classpath path="${basedir}/target/jacoco-jars/org.jacoco.ant.jar"/>
> </taskdef>
> <mkdir dir="${basedir}/target/coverage-report"/>
> <report>
> <executiondata>
> <fileset dir="${build.directory.projecta}">
> <include name="jacoco.exec"/>
> </fileset>
> <fileset dir="${build.directory.projectb}">
> <include name="jacoco.exec"/>
> </fileset>
> <fileset dir="${build.directory.projectc}">
> <include name="jacoco.exec"/>
> </fileset>
> <fileset dir="${build.directory.projectd}">
> <include name="jacoco.exec"/>
> </fileset>
> <fileset dir="${build.directory.projecte}">
> <include name="jacoco.exec"/>
> </fileset>
> <fileset dir="${build.directory.projectf}">
> <include name="jacoco.exec"/>
> </fileset>
> </executiondata>
> <structure name="jacoco-multi Coverage Project">
> <group name="jacoco-multi">
> <classfiles>
> <fileset dir="${classes.directory.projecta}"/>
> <fileset dir="${classes.directory.projectb}"/>
> <fileset dir="${classes.directory.projectc}"/>
> <fileset dir="${classes.directory.projectd}"/>
> <fileset dir="${classes.directory.projecte}"/>
> <fileset dir="${classes.directory.projectf}"/>
> </classfiles>
> <sourcefiles encoding="UTF-8">
> <fileset dir="${sources.directory.projecta}"/>
> <fileset dir="${sources.directory.projectb}"/>
> <fileset dir="${sources.directory.projectc}"/>
> <fileset dir="${sources.directory.projectd}"/>
> <fileset dir="${sources.directory.projecte}"/>
> <fileset dir="${sources.directory.projectf}"/>
> </sourcefiles>
> </group>
> </structure>
> <html destdir="${basedir}/target/coverage-report/html"/>
> <xml destfile="${basedir}/target/coverage-report/coverage-report.xml"/>
> <csv destfile="${basedir}/target/coverage-report/coverage-report.csv"/>
> </report>
> </target>
>
> The problem is the resulting report says many of the classes have no unit 
> test coverage when in fact they are fully unit tested.
>
> Also I can't even get the Jacoco plugin to exclude certain folders of 
> source files.
>
> Perhaps there is a better way to configure Jacoco for multimodule projects 
> to get one consolidated report? 
>
> So I don't know if the problem is with the approach I am using or if its 
> with JDK17. It does report code coverage on a few of the classes just not 
> on all of them.
>
> Is there a definitive best approach for creating consolidated reports in 
> multi-module Maven builds?
>
> Thanks,
> -David
>
>
> On Friday, September 8, 2023 at 5:44:15 AM UTC-6 Marc R. Hoffmann wrote:
>
>> Hi David,
>>
>> we publish the master branch to this Snapshot repository:
>>
>>
>> https://oss.sonatype.org/content/repositories/snapshots
>>
>> But 0.10.0 should support Java 17. What exactly is the problem?
>>
>> Regards,
>> -marc
>>
>>
>>
>> On 8. Sep 2023, at 00:16, David Hoffer <dhof...@gmail.com> wrote:
>>
>> I read here https://www.jacoco.org/jacoco/trunk/doc/changes.html that 
>> there is a 0.8.11 snapshot build available.  Where can I download this one 
>> or the latest one?
>>
>> I am having problems in a JDK17 build getting accurate code coverage 
>> reports using 0.8.10 so was hoping to try a later build.
>>
>> -Dave
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "JaCoCo and EclEmma Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jacoco+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jacoco/28163b1d-7de3-4eb1-9c86-8b181d7261bbn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jacoco/28163b1d-7de3-4eb1-9c86-8b181d7261bbn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/adbb0c67-c3a3-4c6f-8309-fa538ee542d7n%40googlegroups.com.

Reply via email to