Hi, "report" goal ( http://www.jacoco.org/jacoco/trunk/doc/report-mojo.html ) generates report containing *source files of a current module* by design, even if you are trying to trick it by copying class files.
There is "report-aggregate" ( http://www.jacoco.org/jacoco/trunk/doc/report-aggregate-mojo.html ) for generation of report for *multiple projects within same reactor.* This includes the case, when tests are in separate modules than the code under test - https://stackoverflow.com/a/41901853/244993 For more complex scenarios, e.g. when projects are not part of same Maven reactor, use other integration, e.g. e.g. JaCoCo Ant Tasks with maven-antrun-plugin or JaCoCo command line interface. On Tuesday, March 27, 2018 at 6:11:59 PM UTC+2, [email protected] wrote: > > Hello, > I have a RESTFul web service project that has a couple of get and put > calls. This is a Maven project and from now I will refer to it as 'Dev > project' from now on. > I have compiled this project with the debug flag and have deployed the > webapp on Glassfish. > > I also have an integration test project that is a separate maven project > and makes calls to the Dev project. In the POM of this project I am > preparing the Java agent and am copying the .class files of the Dev > project to a certain location under the target folder of the test project. > The tests in this project make web service end points implemented in the > Dev project and my goal is to get coverage when I run 'mvn verify'. > > > The issue here is when a report is generated there is no line level > coverage even though the class level coverage seems accurate. Could you > please point out what am I missing because of which the report is missing > line level coverage. > > TEST POM: > <build> > <finalName>JaxRsAppTest</finalName> > <plugins> > <plugin> > <groupId>org.jacoco</groupId> > <artifactId>jacoco-maven-plugin</artifactId> > <version>0.7.9</version> > <executions> > <execution> > <id>pre-integration-test</id> > <phase>initialize</phase> > <goals> > <goal>prepare-agent</goal> > </goals> > <configuration> > > <destFile>${project.build.directory}/coverage-reports-test/jacoco-test-it.exec</destFile> > <propertyName>failsafeArgLine</propertyName> > </configuration> > </execution> > <execution> > <id>post-integration-test</id> > <phase>post-integration-test</phase> > <goals> > <goal>report</goal> > </goals> > <configuration> > > <dataFile>${project.build.directory}/coverage-reports-test/jacoco-test-it.exec</dataFile> > > <outputDirectory>${project.reporting.outputDirectory}/jacoco-test-it</outputDirectory> > </configuration> > </execution> > </executions> > > </plugin> <!-- copies the Dev project's class files to the > target of the test project> > <plugin> > <artifactId>maven-resources-plugin</artifactId> > <version>3.0.2</version> > <executions> > <execution> > <id>copy-resources</id> > <phase>pre-integration-test</phase> > <goals> > <goal>copy-resources</goal> > </goals> > <configuration> > > <outputDirectory>S:/JaxRsApp/Test/test-JaxRS/target/classes</outputDirectory> > <resources> > <resource> > > <directory>S:/JaxRsApp/Dev/dmahapat_JaxRsApp/target/classes</directory> > <filtering>false</filtering> > > </resource> > </resources> > </configuration> > </execution> > </executions> > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-failsafe-plugin</artifactId> > <version>2.20.1</version> > <configuration> > <argLine>${failsafeArgLine}</argLine> > <includes> > <include>**/*IntegrationTest.java</include> > </includes> > > </configuration> > <executions> > <execution> > <id>integration-tests</id> > <phase>integration-test</phase> > <goals> > <goal>integration-test</goal> > <goal>verify</goal> > </goals> > </execution> > </executions> > > Thanks in advance. > > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/ad1e9c74-ad3d-4b7a-9594-b80763fa2abc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
