title: Using Jacoco's offline instrumentation for a multi-module maven project using surefire coverage
body: <p>I am using Jacoco to calculate coverage on a multi-module project via a final aggregator-module which generates the report. The project's parent pom file has surefire &amp; Jacoco configured as the following:</p>
  
  <pre><code> &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.18.1&lt;/version&gt;
      &lt;configuration&gt;
        &lt;testFailureIgnore&gt;true&lt;/testFailureIgnore&gt;
        &lt;argLine&gt;${argLine} -Xmx2048m -Duser.timezone=UTC&lt;/argLine&gt;
        &lt;forkedProcessTimeoutInSeconds&gt;1200&lt;/forkedProcessTimeoutInSeconds&gt;
        &lt;forkCount&gt;1&lt;/forkCount&gt;
        &lt;reuseForks&gt;true&lt;/reuseForks&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
      &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;0.8.0&lt;/version&gt;
      &lt;executions&gt;
          &lt;execution&gt;
          &lt;id&gt;default-prepare-agent&lt;/id&gt;
          &lt;goals&gt;
            &lt;goal&gt;prepare-agent&lt;/goal&gt;
          &lt;/goals&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>And the project's final reporting module (which inherits all the other modules as dependencies) has Jacoco configured as follows:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
      &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;0.8.0&lt;/version&gt;
      &lt;executions&gt;
        &lt;execution&gt;
          &lt;id&gt;report-aggregate&lt;/id&gt;
          &lt;phase&gt;test&lt;/phase&gt;
          &lt;goals&gt;
            &lt;goal&gt;report-aggregate&lt;/goal&gt;
          &lt;/goals&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>However i'm getting jacoco warnings relating to tests in some of the modules:</p>
  
  <pre><code>[INFO] Analyzed bundle 'project-submod1' with 46 classes
  [WARNING] Classes in bundle 'project-submod1' do no match with execution data. For report generation the same class files must be used as at runtime.
  [WARNING] Execution data for class org/project/submod1/ExampleClass does not match.
  </code></pre>
  
  <p>So i've read I can use either offline instrumentation or setting the classDumpDir to get around this problem: <a href="http://www.eclemma.org/jacoco/trunk/doc/classids.html" rel="nofollow noreferrer">http://www.eclemma.org/jacoco/trunk/doc/classids.html</a></p>
  
  <p>However i'm unsure of how to accomplish the two options. I've tried to add offline instrumentation tasks to Jacoco in the parent pom file, but I then get complaints that classes are already instrumented. Or if I set  ClassDumpDir for each module, I can't seem to have the final report use each modules' dumped classes, rather than the modified ones... </p>