Using the information at https://github.com/powermock/powermock/wiki/Code-coverage-with-JaCoCo and the offline example it links to, I set up jacoco in my largish maven multiproject build. The build has an overall parent pom that all the child modules inherit from, and there is a separate aggregator pom. I put the settings for jacoco in the parent pom.
The following is a paraphrased view of the parent pom, with some elements removed that I believe are irrelevant: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> <junit.version>4.11</junit.version> <mockito.version>1.10.19</mockito.version> <powermock.version>1.6.6</powermock.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>${mockito.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <version>${powermock.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito</artifactId> <version>${powermock.version}</version> <scope>test</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit4</artifactId> <version>2.19.1</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> </plugins> <pluginManagement> <plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.8</version> <executions> <execution> <id>default-instrument</id> <goals> <goal>instrument</goal> </goals> <configuration> <dataFile>${project.build.directory}/coverage.exec </dataFile> </configuration> </execution> <execution> <id>default-restore-instrumented-classes</id> <goals> <goal>restore-instrumented-classes</goal> </goals> </execution> <execution> <id>report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <forkCount>3</forkCount> <aggregate>true</aggregate> <reuseForks>true</reuseForks> <argLine>-Xmx1024m</argLine> <testSourceDirectory> ${project.build.testSourceDirectory}</testSourceDirectory> <includes> <include>**/*Test.java</include> </includes> <systemPropertyVariables> <jacoco-agent.destfile> ${project.build.directory}/coverage.exec</jacoco-agent.destfile> </systemPropertyVariables> </configuration> </plugin> </plugins> </pluginManagement> </build> </project> When I run the build at the top-level, or in one of the child modules, I see every test failing with the following: java.lang.NoClassDefFoundError: org/jacoco/agent/rt/internal_e5875b2/Offline Any ideas what might be wrong here? -- 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/492115bb-d2bb-428b-adb2-3b2248e215be%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
