trautonen / coveralls-maven-plugin

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

Coveralls source-view fails if source is in subfolder #35

Closed stefan2904 closed 10 years ago

stefan2904 commented 10 years ago

My maven project is in a subfolder ("bar") of my github-repository.

Now the Coveralls source-view tries to open "src/package/foo.java" instead of "bar/src/package/foo.java".

I was not able to add this "base folder", neither with your plugin nor directly on Coveralls (their "Git repo root directory" option only works to cut of path-parts).

trautonen commented 10 years ago

Oh great, now they did the change that the pushed in sources are not stored anymore and the sources are dynamically loaded. But they miserably assume that the file path used for the file is exactly the path for the file in the github repository.

Unless they make some api changes so that the actual source cannot be defined along with the display name for the file this is quite hard or nearly impossible to fix. My guess is that almost every custom Coveralls plugin is broken the same way now.

stefan2904 commented 10 years ago

What would happen if your plugin would send an absoulte path?

trautonen commented 10 years ago

There are two issues for absolute path. Maven only knows the directory where it is started, which in your case is not the root of the repo. This would require some configuration parameter to append to paths. Another issue is Cobertura and inner classes. Cobertura generates same file name for inner classes goverage than parent class. My plugin handles this by adding a custom suffix to files that are mapped to inner class coverage and they are of course not any real files in any github repository.

stefan2904 commented 10 years ago

coveralls now has a "Git repo sub directory" option (just under "Git repo root directory").

This fixes the problem.

trautonen commented 10 years ago

Oh this is great. I thought i need to do some hacky tricks to get the directories right. Though I cannot find this option anywhere in my own repos. In what view that "Git repo root directory" and "Git repo sub directory" should be available?

stefan2904 commented 10 years ago

It appears instead of the source code view, if the code could not found on the expected location.

It appears that you cannot see it, if the source is there.

trautonen commented 10 years ago

Thanks. Found it now. Will add a note in the documentation.

vincent-zurczak commented 10 years ago

Hi,

I know this issue is marked as closed, but Coveralls solution with Git repo sub directory does not seem suitable for multi-module projects. I may be wrong, but I don't see how it could work for such projects.

trautonen commented 10 years ago

@vincent-zurczak yes you are absolutely right. I forgot how multi module projects were aggregated. There is no module directory prefix for the file names. They are created according the Java package name. I will create a new issue for this one and get it fixed in the next release. Though I'm quite busy now so might take a while until I get it done.

vertti commented 10 years ago

Any updates on this regarding the multimodule projects? Did you create a new issue for it, I don't seem to find it.