0

I've maven project1, which has src/main/java -- application source code

I do have another maven project2, which has all tests src/main/test -- all api tests which are all part of above project1

Now, Is there any way to configure Java Jacoco code coverage agent in project2 in such away that It should calculate code coverage of project1 when execute tests from project2 ?

Thanks in advance, I know it's kind of theoretical question.

1 Answers1

0

Speaking in general - yes it is possible:

  • By default agent collects information about execution of all the classes, no matter from where they come.
  • Report generation requires collected information about execution, plus original class files and sources for which you want to generate report.

If both projects are part of the same Maven reactor, then have a look at jacoco simple integration test solution . If not, then JaCoCo Ant Tasks that provide flexibility in specification of paths - http://www.jacoco.org/jacoco/trunk/doc/ant.html

Community
  • 1
  • 1
Godin
  • 9,801
  • 2
  • 39
  • 76