Saturday, June 14, 2014

"Skipping JaCoCo execution ...." problem in maven project


For Checkstyle project I decided to use coveralls.io service to show UTs coverage as banner.
I used that instruction to make it for java maven project. Amazing documentation with example description worked fire for simple projects(sevntu.checkstyle , dsm-maven-plugin).

But For Checkstyle I had an error:

[romani]$ mvn jacoco:report coveralls:jacoco

...

[INFO] Skipping JaCoCo execution due to missing execution data file:/home/travis/build/checkstyle/checkstyle/target/jacoco.exec

...

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:2.2.0:jacoco (default-cli) on project checkstyle: I/O operation failed: /home/travis/build/checkstyle/checkstyle/target/site/jacoco/jacoco.xml (No such file or directory) -> [Help 1]


That problem is happening when jacoco failed or did not registered his agent to instrument some code and gather statistics before tests are launched. 

Problem was in surefire-plugin, that was declared as:
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <argLine>-Duser.language=en -Duser.country=US</argLine>
        </configuration>
      </plugin>

Proper configuration is (attention to bold part):
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <argLine>${argLine} -Duser.language=en -Duser.country=US</argLine>
        </configuration>
      </plugin>
.

final version of my pom.xml (see "travis" profile) and travis.yml.

Useful links that I used for investigation:

No comments:

Post a Comment