As stated on page http://www.jacoco.org/jacoco/trunk/doc/offline.html : 
"Unlike with on-the-fly instrumentation offline instrumented classes get a 
direct dependency on the JaCoCo runtime."

In our example at 
http://www.jacoco.org/jacoco/trunk/doc/examples/build/pom-offline.xml as 
well as in cited example 
at 
https://github.com/powermock/powermock-examples-maven/blob/master/jacoco-offline/pom.xml#L56-L61
 
there is such dependency, which you seem to be missed:

<dependency>
  <groupId>org.jacoco</groupId>
  <artifactId>org.jacoco.agent</artifactId>
  <version>${jacoco.version}</version>
  <classifier>runtime</classifier>
</dependency>

On Sunday, January 22, 2017 at 9:57:44 PM UTC+1, David Karr wrote:
>
> Using the information at 
> https://github.com/powermock/powermock/wiki/Code-coverage-with-JaCoCo 
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fpowermock%2Fpowermock%2Fwiki%2FCode-coverage-with-JaCoCo&sa=D&sntz=1&usg=AFQjCNHUjB20b60xH6KCVta-3FfzhVABZg>
>  
> 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/caba098b-f33a-4ed5-a6df-71168fbe52cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to