trautonen / coveralls-maven-plugin

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

Coveralls #6

Closed karussell closed 11 years ago

karussell commented 11 years ago

Hi, thanks for your plugin!

I've tried your plugin for my graphhopper project. I started with cobertura but nothing happens: https://travis-ci.org/graphhopper/graphhopper/jobs/8633626

I also tried jacoco but it says: [ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:1.1.0:jacoco (default-cli) on project graphhopper: IO operation failed: /home/travis/build/graphhopper/graphhopper/core/target/site/jacoco/jacoco.xml (No such file or directory) -> [Help 1](the same error message I get when trying it locally) See https://travis-ci.org/graphhopper/graphhopper/jobs/8634425

Probably I've failed to understand how to configure the named plugins ... do you have a tip? I've looked at how you did it with https://github.com/trautonen/jersey-mustache but probably have missed something

Also which do you prefer - cobertura or jacoco?

trautonen commented 11 years ago

JaCoCo is executed in the test phase and prepare-agent goal puts the execution file in place. You have only plugin management section in your pom.xml, but the plugin is never actually defined. As JaCoCo is not run as standalone goal, you must add the plugin to the plugins section too. Cobertura is run from standalone goal so the explicit plugin definition is not required.

There's not much difference in the actual coverage reported by the 2 plugins, and I haven't done any performance benchmarks with them, but there are 2 notable differences:

karussell commented 11 years ago

Thanks! I tried cobertura now and locally this works and creates the html report:

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

But in travis it says:

[WARNING] The requested profile "cobertura" could not be activated because it does not exist.

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:1.1.0:cobertura (default-cli) on project graphhopper: IO operation failed: /home/travis/build/graphhopper/graphhopper/core/target/site/cobertura/coverage.xml (No such file or directory) -> [Help 1]

and nothing happened in coveralls

trautonen commented 11 years ago

Coveralls maven plugin requires XML format for Cobertura coverage reports. Default configuration for Cobertura is HTML format, which is not parsed by the plugin. See the coveralls-maven-plugin README for correct usage.

karussell commented 11 years ago

Thanks a lot that fixed the problem and I got some results on coveralls and I think they are calculating now :) !

One last question: I build the project for three different jdks. Can I somehow force that cobertura is executed only once?

trautonen commented 11 years ago

I think you could make a shell script (or ruby or python) that replaces the normal travis script part for the maven command. In the script you could check from environment variables which JDK is selected and change the command to run (either normal test or coveralls run). I haven't done anything like this, but i think it's doable.

karussell commented 11 years ago

Good idea! Thanks for sharing!