0

Ive got a middle to large scaled project with ~150k LOC. Jacoco maven-plugin generates reports on each and every unit test to the file jacoco.exec.

So, basically this is the surefire setup in pom.xml:

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <version>2.17</version>
     <configuration>
      <argLine>-XX:-UseSplitVerifier</argLine>
      <includes>
       <include>**/*Test.java</include>
       <include>**/*Tests.java</include>
      </includes>
      <excludes>
       <exclude>**/it/*IT.java</exclude>
       <exclude>**/*IT.java</exclude>
      </excludes>
                        <properties>
                            <property>
                                <name>listener</name>
                                <value>org.sonar.java.jacoco.JUnitListener</value>
                            </property>
                        </properties>
     </configuration>
    </plugin>
 <plugin>

The tricky part being the JUnitListener. The target jacoco.exec file becomes 4,5 Gb large (huge!). Once our Jenkins CI slaves starts processing the file, the sonar runner (maven artifact as well) tries to load the entire file into memory - or so it seems. And that requires Heap size of 8 gig.. This seems entirely wrong, doesnt it?

Question here is, can anything be done to minimize the size of jacoco.exec? We are restricted to Java 1.6 SDK (have noticed size becoming < 2 Gb with Java 1.7). Im guessing the debug symbols are a nescessity for creating the coverage report or am i wrong?

3
  • yes debug is required during compilation. Hm I never saw .exec file going more than few MBs.
    – AKS
    Commented Nov 23, 2014 at 23:00
  • The key to the size of the .exec file is our 'coverage-per-test' profile. I've inserted the <properties> section above with extra indentation. Monitoring the filesize during test-phase (junit) indicates that a dump of the VM state is injected for each test. And i've read, it is divided into success/failed - but thats all i about the process know basically
    – mschr
    Commented Nov 24, 2014 at 11:34
  • bump none has any experience with this issue?
    – mschr
    Commented Dec 10, 2014 at 9:14

1 Answer 1

0

clean jacoco .exec file before running. it seems that jacoco is appending to existing file. adding the jacoco listener increases the file size significantly. after a few runs you got GB files. i also had experienced that sonarqube cannot parse files with > 4 GB. or you can explizit set append to false. this is a gradle example:

test {
    jacoco {
        append = false
        destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
    }
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.