trautonen / coveralls-maven-plugin

Maven plugin for submitting Java code coverage reports to Coveralls web service.
MIT License
312 stars 123 forks source link

coverage report file not found #50

Open bluestreak01 opened 9 years ago

bluestreak01 commented 9 years ago

I have a setup with parent pom.xml with no source and modules with coverage files. Plugin fails to find coverage files with this error:

mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.0:report (default-cli) on project nfsdb: I/O operation failed: No coverage report files found -> [Help 1]

trautonen commented 9 years ago

Make sure you have configured Cobertura correctly. You need to use XML format in the reports:

  <configuration>
    <format>xml</format>
    <aggregate>true</aggregate>
  </configuration>

The aggregate property is not mandatory, but suggested for multi module projects. That way you delegate the report aggregation for the coverage tool.

By default the Cobertura reports are looked from .../module1/target/site/cobertura/coverage.xml and similar directories. Make sure after running cobertura:cobertura you have such files generated. If aggregate is set for Cobertura, the coverage report is expected to be located relative to the root project target/site/cobertura/coverage.xml.

bluestreak01 commented 9 years ago

Thank you for prompt reply. My parent pom.xml looks like this:

            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <sourceEncoding>UTF8</sourceEncoding>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <check>true</check>
                    <format>xml</format>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>

Unfortunately the error remains the same.

trautonen commented 9 years ago

The configuration looks fine. Are you running Cobertura with Java 8? If so, no results are expected, because Cobertura fails with Java 8. You can only change to JaCoCo's latest version, which supports Java 8.

bluestreak01 commented 9 years ago

I use Java 7, have not tried Java 8 yet.

trautonen commented 9 years ago

Java version is ruled out then. You should run your maven build with -X flag for debugging and look for lines like:

[cobertura] DEBUG [main] net.sourceforge.cobertura.reporting.Main - format is xml encoding is UTF-8
[cobertura] DEBUG [main] net.sourceforge.cobertura.reporting.Main - dataFile is .../sample/target/cobertura/cobertura.ser
[cobertura] DEBUG [main] net.sourceforge.cobertura.reporting.Main - destinationDir is .../sample/target/site/cobertura

INFO: Cobertura: Loaded information on 5 classes.

[INFO] Cobertura Report generation was successful.

And if you are running local build, verify that the coverage.xml files are found under the target.

bluestreak01 commented 9 years ago

Cobertura runs, but no coverage.xml is generated. I'm not sure why. This is probably the cause for coveralls failure. I'll have to park this for next few days, thank you for your help!

kermitt2 commented 9 years ago

Maybe this can be useful... I had exactly the same issue with Cobertura and a multi-module project with the parent having no test. For me, the error was that I set my <plugin> definitions in the parent pom under <reporting> (as for the javadoc plugin) instead of <build>. With Cobertura and the coveralls plugin correctly configured under , it worked fine.