no code coverage for dependencies (maven)

51 views
Skip to first unread message

andre....@googlemail.com

unread,
Jul 29, 2015, 2:33:16 PM7/29/15
to JaCoCo and EclEmma Users
Hi,
i am struggling to get code coverage for dependent classes with jacoco maven plugin.

My project structure is like following:

[workspace]
|-pom.xml
|-[module_1]
|-pom.xml
|-[src]
|-[java]
|-class1
|-[test]
|-class1test
|-[module_2]
|-pom.xml
|-[src]
|-[java]
|-class2
|-[test]

class1 needs class2 from module_2, but when i run the unit test class1test i get no code coverage for class2.

I googled hours but can't find a solution that works.

Some posts mentioned to use <classDumpDir> to dump the classes and use them at report generation. Dumping the classes works fine.
But i can't find an example how to use the dumped classes while generating the report.
I tried to use <include> in the configuration section of report configuration but this results in an empty report.

Can anyone explain how to use the dumped classes at report generation?

Regards,
Andre

Marc Hoffmann

unread,
Jul 30, 2015, 10:44:51 AM7/30/15
to jac...@googlegroups.com
Hi,

the JaCoCo Maven plug-in creates code coverage for single modules only.
Since quite some time we have a long outstanding feature requests for
this:

https://github.com/jacoco/jacoco/pull/97

As structured reports are supported by Ant, for JaCoCo itself we use the
ant-runner to create the report, see:


https://github.com/jacoco/jacoco/blob/master/org.jacoco.doc/pom.xml#L76

Regards,
-marc

andre....@googlemail.com

unread,
Aug 4, 2015, 4:53:04 AM8/4/15
to JaCoCo and EclEmma Users
Am Donnerstag, 30. Juli 2015 16:44:51 UTC+2 schrieb Marc R. Hoffmann:
> Hi,
>
> the JaCoCo Maven plug-in creates code coverage for single modules only.
> Since quite some time we have a long outstanding feature requests for
> this:
>
> https://github.com/jacoco/jacoco/pull/97
>
> As structured reports are supported by Ant, for JaCoCo itself we use the
> ant-runner to create the report, see:
>
>
> https://github.com/jacoco/jacoco/blob/master/org.jacoco.doc/pom.xml#L76
>
> Regards,
> -marc
>

OK, thanks!

I waste some time to get this running in a sample project. maven complains about a missing build-main.xml. But as i understand in need no build-xml's when defining the ant task in maven, am i wrong?

Regards,
Andre

Marc Hoffmann

unread,
Aug 4, 2015, 5:29:21 AM8/4/15
to jac...@googlegroups.com
Hi Andre,

I'm not too much into Maven but from my understanding the Ant script is
directly embedded within the POM. At least for the JaCoCo build it works
like this.

Regards,
-marc

andre....@googlemail.com

unread,
Aug 5, 2015, 2:35:51 AM8/5/15
to JaCoCo and EclEmma Users

Hi Marc,
i solved it. My fault was that i put the ant-run pom that you linked too diretcly in my root-pom. But i have to create an extra project, and now it works.

Regards,
Andre

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages