trautonen / coveralls-maven-plugin

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

Generated sources #22

Closed vertti closed 10 years ago

vertti commented 10 years ago

When running my

after_success:
  - mvn clean cobertura:cobertura coveralls:cobertura

I get error of missing HelpMojo.java. My project is a maven plugin and HelpMojo is a generated resource by the maven-plugin-plugin. For some reason coveralls plugin fails to find it.

Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:2.0.1:cobertura (default-cli) on project drm-parent: Build error: Could not find source file com/nitorcreations/HelpMojo.java from any source directory -> [Help 1]

Project I'm working on is https://github.com/NitorCreations/DomainReverseMapper if that helps in debugging.

trautonen commented 10 years ago

Actually I bumped into the exactly same issue with this maven plugin. In my opinion there is no reason to test generated sources, because it is more likely the source generator which you want to test, not what it generates. And assuming we are using a third party library, it's not your job to test it along with your project.

See https://github.com/trautonen/coveralls-maven-plugin/blob/master/pom.xml#L247 as one solution for this problem. It just tells cobertura to ignore the generated source file. I think you could use also the plugin's explicit source directories definition and add also the generated sources dir, but as your project is multi-module project, you'd need to define the submobule source directories too and everything becomes cumbersome.

Do you think this is acceptable solution or should some extra effort be put on finding a better solution for handling generated sources?

vertti commented 10 years ago

Definitely no point in measuring coverages for generated stuff so your suggested solutions is both fine for me and probably the correct way too. I'd add a note of this to your plugins FAQ and close this issue. Thanks for your fast reply!

trautonen commented 10 years ago

Added entry in the FAQ, will close now.