You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by se...@posteo.de on 2025/05/05 19:24:14 UTC

Is it possible to have jacoco's and pmd's report-aggregate in the same Maven artifact?

Hello!

Let's assume I have three Maven artifacts: One aggregating parent 
artifact and two children modules.

I'd like to generate an aggregating report both for jacoco and pmd, each 
comprising both children modules. I'd like those two aggregatings 
reports to be located in the same Maven artifact. Is this possible?

[1] says regarding "jacoco:report-aggregate": "Creates a structured code 
coverage report [...] from multiple projects within reactor. The report 
is created from all modules this project depends on [...]."
[2] says regarding "pmd:aggregate-pmd": "Creates a PMD site report in an 
aggregator project [...]".

This doesn't work well together, does it? An aggregating PMD report has 
to be in an aggregator project, but jacoco would need the aggregator 
project to depend on the two children, which doesn't work.

In fact, I managed to create an aggregating report for jacoco by 
introducing another child-report module which depends on the other two 
children modules, and I managed to create an aggregating report for PMD 
inside the aggregating parent artifact, but I couldn't make both reports 
to be in the same artifact.

I'd like to make sure that I'm not maybe missing something or if this 
indeed is not possible. The reason I'm asking is because to me it feels 
a bit clumsy that when generating a Maven site for the aforementioned 
structure one has two consult two different places inside this site to 
see all aggregating reports.

[1] https://www.eclemma.org/jacoco/trunk/doc/report-aggregate-mojo.html
[2] 
https://maven.apache.org/plugins/maven-pmd-plugin/aggregate-pmd-mojo.html

Best regards
Tobias

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is it possible to have jacoco's and pmd's report-aggregate in the same Maven artifact?

Posted by Tamás Cservenák <ta...@cservenak.net>.
Howdy,

am unsure would it help, so just throwing in ideas...
Did you try this plugin
https://github.com/olamy/jacoco-aggregator-maven-plugin ?

Thanks
T

On Tue, May 6, 2025 at 9:50 PM <se...@posteo.de> wrote:
>
> Maybe this might be helpful for someone having the same problem: While I
> couldn't make it work with the aggregator being the parent as well, as a
> workaround I managed to create both aggregating reports in the
> aggregator by introducing a separate parent project (being the parent
> for all other projects). This way, the aggreagtor is able to have
> dependencies on its children projects and the jacoco aggregate report
> can be generated inside the aggregator, too.
>
> Am 05.05.2025 21:24 schrieb seekm@posteo.de:
> > Hello!
> >
> > Let's assume I have three Maven artifacts: One aggregating parent
> > artifact and two children modules.
> >
> > I'd like to generate an aggregating report both for jacoco and pmd,
> > each comprising both children modules. I'd like those two aggregatings
> > reports to be located in the same Maven artifact. Is this possible?
> >
> > [1] says regarding "jacoco:report-aggregate": "Creates a structured
> > code coverage report [...] from multiple projects within reactor. The
> > report is created from all modules this project depends on [...]."
> > [2] says regarding "pmd:aggregate-pmd": "Creates a PMD site report in
> > an aggregator project [...]".
> >
> > This doesn't work well together, does it? An aggregating PMD report
> > has to be in an aggregator project, but jacoco would need the
> > aggregator project to depend on the two children, which doesn't work.
> >
> > In fact, I managed to create an aggregating report for jacoco by
> > introducing another child-report module which depends on the other two
> > children modules, and I managed to create an aggregating report for
> > PMD inside the aggregating parent artifact, but I couldn't make both
> > reports to be in the same artifact.
> >
> > I'd like to make sure that I'm not maybe missing something or if this
> > indeed is not possible. The reason I'm asking is because to me it
> > feels a bit clumsy that when generating a Maven site for the
> > aforementioned structure one has two consult two different places
> > inside this site to see all aggregating reports.
> >
> > [1] https://www.eclemma.org/jacoco/trunk/doc/report-aggregate-mojo.html
> > [2]
> > https://maven.apache.org/plugins/maven-pmd-plugin/aggregate-pmd-mojo.html
> >
> > Best regards
> > Tobias
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is it possible to have jacoco's and pmd's report-aggregate in the same Maven artifact?

Posted by se...@posteo.de.
Thank you for creating this (and thanks, Tamás, too, for the 
suggestion)!

This seems to be what I need, I'll investigate this option - thanks a 
lot!

Am 06.05.2025 23:02 schrieb Olivier Lamy:
> If it can help, I created a simple mojo to easily aggregate jacoco
> reports for multi modules projects without the need to have extra
> empty module (see
> https://github.com/olamy/jacoco-aggregator-maven-plugin/)
> 
> On Wed, 7 May 2025 at 05:50, <se...@posteo.de> wrote:
>> 
>> Maybe this might be helpful for someone having the same problem: While 
>> I
>> couldn't make it work with the aggregator being the parent as well, as 
>> a
>> workaround I managed to create both aggregating reports in the
>> aggregator by introducing a separate parent project (being the parent
>> for all other projects). This way, the aggreagtor is able to have
>> dependencies on its children projects and the jacoco aggregate report
>> can be generated inside the aggregator, too.
>> 
>> Am 05.05.2025 21:24 schrieb seekm@posteo.de:
>> > Hello!
>> >
>> > Let's assume I have three Maven artifacts: One aggregating parent
>> > artifact and two children modules.
>> >
>> > I'd like to generate an aggregating report both for jacoco and pmd,
>> > each comprising both children modules. I'd like those two aggregatings
>> > reports to be located in the same Maven artifact. Is this possible?
>> >
>> > [1] says regarding "jacoco:report-aggregate": "Creates a structured
>> > code coverage report [...] from multiple projects within reactor. The
>> > report is created from all modules this project depends on [...]."
>> > [2] says regarding "pmd:aggregate-pmd": "Creates a PMD site report in
>> > an aggregator project [...]".
>> >
>> > This doesn't work well together, does it? An aggregating PMD report
>> > has to be in an aggregator project, but jacoco would need the
>> > aggregator project to depend on the two children, which doesn't work.
>> >
>> > In fact, I managed to create an aggregating report for jacoco by
>> > introducing another child-report module which depends on the other two
>> > children modules, and I managed to create an aggregating report for
>> > PMD inside the aggregating parent artifact, but I couldn't make both
>> > reports to be in the same artifact.
>> >
>> > I'd like to make sure that I'm not maybe missing something or if this
>> > indeed is not possible. The reason I'm asking is because to me it
>> > feels a bit clumsy that when generating a Maven site for the
>> > aforementioned structure one has two consult two different places
>> > inside this site to see all aggregating reports.
>> >
>> > [1] https://www.eclemma.org/jacoco/trunk/doc/report-aggregate-mojo.html
>> > [2]
>> > https://maven.apache.org/plugins/maven-pmd-plugin/aggregate-pmd-mojo.html
>> >
>> > Best regards
>> > Tobias
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is it possible to have jacoco's and pmd's report-aggregate in the same Maven artifact?

Posted by Olivier Lamy <ol...@apache.org>.
If it can help, I created a simple mojo to easily aggregate jacoco
reports for multi modules projects without the need to have extra
empty module (see
https://github.com/olamy/jacoco-aggregator-maven-plugin/)

On Wed, 7 May 2025 at 05:50, <se...@posteo.de> wrote:
>
> Maybe this might be helpful for someone having the same problem: While I
> couldn't make it work with the aggregator being the parent as well, as a
> workaround I managed to create both aggregating reports in the
> aggregator by introducing a separate parent project (being the parent
> for all other projects). This way, the aggreagtor is able to have
> dependencies on its children projects and the jacoco aggregate report
> can be generated inside the aggregator, too.
>
> Am 05.05.2025 21:24 schrieb seekm@posteo.de:
> > Hello!
> >
> > Let's assume I have three Maven artifacts: One aggregating parent
> > artifact and two children modules.
> >
> > I'd like to generate an aggregating report both for jacoco and pmd,
> > each comprising both children modules. I'd like those two aggregatings
> > reports to be located in the same Maven artifact. Is this possible?
> >
> > [1] says regarding "jacoco:report-aggregate": "Creates a structured
> > code coverage report [...] from multiple projects within reactor. The
> > report is created from all modules this project depends on [...]."
> > [2] says regarding "pmd:aggregate-pmd": "Creates a PMD site report in
> > an aggregator project [...]".
> >
> > This doesn't work well together, does it? An aggregating PMD report
> > has to be in an aggregator project, but jacoco would need the
> > aggregator project to depend on the two children, which doesn't work.
> >
> > In fact, I managed to create an aggregating report for jacoco by
> > introducing another child-report module which depends on the other two
> > children modules, and I managed to create an aggregating report for
> > PMD inside the aggregating parent artifact, but I couldn't make both
> > reports to be in the same artifact.
> >
> > I'd like to make sure that I'm not maybe missing something or if this
> > indeed is not possible. The reason I'm asking is because to me it
> > feels a bit clumsy that when generating a Maven site for the
> > aforementioned structure one has two consult two different places
> > inside this site to see all aggregating reports.
> >
> > [1] https://www.eclemma.org/jacoco/trunk/doc/report-aggregate-mojo.html
> > [2]
> > https://maven.apache.org/plugins/maven-pmd-plugin/aggregate-pmd-mojo.html
> >
> > Best regards
> > Tobias
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is it possible to have jacoco's and pmd's report-aggregate in the same Maven artifact?

Posted by se...@posteo.de.
Maybe this might be helpful for someone having the same problem: While I 
couldn't make it work with the aggregator being the parent as well, as a 
workaround I managed to create both aggregating reports in the 
aggregator by introducing a separate parent project (being the parent 
for all other projects). This way, the aggreagtor is able to have 
dependencies on its children projects and the jacoco aggregate report 
can be generated inside the aggregator, too.

Am 05.05.2025 21:24 schrieb seekm@posteo.de:
> Hello!
> 
> Let's assume I have three Maven artifacts: One aggregating parent
> artifact and two children modules.
> 
> I'd like to generate an aggregating report both for jacoco and pmd,
> each comprising both children modules. I'd like those two aggregatings
> reports to be located in the same Maven artifact. Is this possible?
> 
> [1] says regarding "jacoco:report-aggregate": "Creates a structured
> code coverage report [...] from multiple projects within reactor. The
> report is created from all modules this project depends on [...]."
> [2] says regarding "pmd:aggregate-pmd": "Creates a PMD site report in
> an aggregator project [...]".
> 
> This doesn't work well together, does it? An aggregating PMD report
> has to be in an aggregator project, but jacoco would need the
> aggregator project to depend on the two children, which doesn't work.
> 
> In fact, I managed to create an aggregating report for jacoco by
> introducing another child-report module which depends on the other two
> children modules, and I managed to create an aggregating report for
> PMD inside the aggregating parent artifact, but I couldn't make both
> reports to be in the same artifact.
> 
> I'd like to make sure that I'm not maybe missing something or if this
> indeed is not possible. The reason I'm asking is because to me it
> feels a bit clumsy that when generating a Maven site for the
> aforementioned structure one has two consult two different places
> inside this site to see all aggregating reports.
> 
> [1] https://www.eclemma.org/jacoco/trunk/doc/report-aggregate-mojo.html
> [2] 
> https://maven.apache.org/plugins/maven-pmd-plugin/aggregate-pmd-mojo.html
> 
> Best regards
> Tobias
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org