Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report-aggregate does not include report from current project #812

Closed
sidgate opened this issue Dec 31, 2018 · 8 comments
Closed

report-aggregate does not include report from current project #812

sidgate opened this issue Dec 31, 2018 · 8 comments

Comments

@sidgate
Copy link

sidgate commented Dec 31, 2018

Steps to reproduce

Create a multi-module maven project with one module as aggregator. Following is a sample jacoco plugin configuration

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

https://stackoverflow.com/questions/53983849/jacoco-report-aggregate-include-report-of-aggregate-project

JaCoCo version: 0.8.2
Operating system: Windows
Tool integration: Maven

Expected behaviour

report-aggregate should include test report from current aggregate module

Actual behaviour

report is generated only with dependent modules

The plugin does load the execution data for current project, but creates report only from dependencies . May we should just add following before the for loop

support.processProject(group, getProject().getArtifactId(), getProject(), getIncludes(), getExcludes(), sourceEncoding);

@Godin
Copy link
Member

Godin commented Jan 8, 2019

There are already two PRs #430 and #680 (so please search before creation of ticket in future). They are almost identical and contain your proposal, as well as description of why they was not accepted as is. In case if this description is unclear:

current behavior is there since the inception of report-aggregate and IMO clearly stated in documentation

The report is created from all modules this project depends on.

proposed change will bother users who don't want this change - for example we don't need empty org.jacoco.doc in https://www.jacoco.org/jacoco/trunk/coverage/index.html , which is worse than addition of module for you.

Addition of configuration option to resolve this might require changes for existing users, and most importantly based on our experience unconditional clearly stated behavior is preferable than conditional. So maybe you can propose something better?

@Godin Godin added component: maven feedback pending Further information is requested labels Jan 8, 2019
@sidgate
Copy link
Author

sidgate commented Jan 8, 2019

Can we make it configurable, maybe includeCurrentModule=true ? Existing users will not be affected.

@gaellalire
Copy link

Just saw this bug, so I'm the third one to create a pull request #970 for the same thing with the same code. Sorry about this. The documentation may be clear but the behavior is not coherent. It's very disturbing that jacoco.exec of the current project is used but not its sources.

My use case is to test a multi module project, I want the coverage of all sources but for me it's OK if the test of one class is in another module. I just need to combine all jacoco.xml with diff-cover after. If you don't include the root project, I will have twice more jacoco.xml to combine.

I guess the includeCurrentModule boolean is a good solution.
Will you work on it ? Will you merge it if someone write the code for you ?

@ashu101
Copy link

ashu101 commented Mar 25, 2020

please provide support for this. This is a blocker for us

jcai added a commit to wechaty/scala-wechaty that referenced this issue Jun 16, 2020
@iNikem
Copy link

iNikem commented Mar 18, 2022

current behavior is there since the inception of report-aggregate and IMO clearly stated in documentation

The report is created from all modules this project depends on.

Two sentences down from it is this:

In addition execution data is collected from the project itself

Reading this I assume that the current project should be expected as well. At least that is how I read documentation.

@laradong
Copy link

How is it going on?

@paulo-santos
Copy link

paulo-santos commented Jun 1, 2023

How is it going on?

This was implemented in version 0.8.9: #1007
You can use
<includeCurrentProject>true</includeCurrentProject>

See https://www.jacoco.org/jacoco/trunk/doc/report-aggregate-mojo.html

@marchof
Copy link
Member

marchof commented Jun 1, 2023

@paulo-santos Thanks for pointing this out. I'll update this issue.

@marchof marchof closed this as completed Jun 1, 2023
@marchof marchof added this to the 0.8.9 milestone Jun 1, 2023
@marchof marchof added type: enhancement and removed feedback pending Further information is requested labels Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants