-
Notifications
You must be signed in to change notification settings - Fork 25
lcov and cobertura reports sources paths #113
Comments
I can't speak to the Sonar pieces, but I know that this will work out-of-the-box with Jenkins depending on your project structure. By default, the Cobertura report will generate a "sources" element with a pointer to the maven ${basedir} environment variable, which is an absolute path. You are overriding this by providing "sourceDirs" in your configuration. The problem is that you are providing a relative path, so it will not resolve. You can try to use the default sourceDir (by omitting your configuration for sourceDirs) or you can define an absolute path via an environment variable you provide in the configuration. Otherwise, Jenkins won't be able to find the source files. UPDATE: Updating to remove angle brackets from some of the elements I was quoting, as GH markdown interprets them |
I don't completely get your answer; the problem is that the cobertura is generated like this:
while the last line should be:
The src in the filename attribute is the directory in which jasmine-maven-plugin decides to deploy the files during the tests; jenkins cannot find sources under src/, because there is not src/. Unfortunaly it seems it is not possible to set the deployment directory to the root. |
cobertura-plugin in my case works just fine with relative paths; it is just that, in the filename attribute of the class element, the path outputted by saga contains the deploy path generated by jasmine. |
Sorry, I need to have my coffee before I try to answer questions. :) I understand your issue now. Looking at your Jasmine config I don't understand why your files are being hosted at localhost:8234/src instead of localhost:8234/src/main/javascript since the latter reflects that location of your source per the jasmine maven archetype. When I run mvn jasmine:bdd for the OpenSocial explorer project I mentioned above, Jasmine loads the source file via src/main/javascript. I don't understand why your setup is different. Offhand, I don't see anything different in our Jasmine configs that would cause this, unless it's a product of the DojoSpecRunner.htmltemplate that the OSE project is using. If you run mvn jasmine:bdd and go to the test page, where do you see your source being loaded from? |
I am using jasmine-maven-plugin 1.3.1.3 and saga-maven-plugin 1.5.2 to build a jquery plugin. I have some htmlunit failures in jasmine:test so i need to use phantomjs, but this might be unrelated to the problem.
I want to use the cobertura report generated by saga-plugin for jenkins cobertura plugin, and the lcov report for sonar (3.7 with javascript module 1.4).
My sources are in src/main/javascript (as default layout using the maven-jasmine-plugin archetype), jasmine deploys the sources for running the tests in http://host:port/src with the runner in the root.
To be able to load the reported coverage in the jenkins plugin and make the plugin find the sources, i need to add an ant task like (this strips out the filename prefix path):
To let sonar load correctly the lcov coverage, another ant task (this converts relative to absolute):
I tried with all possible combinations of relative paths, but it seems sonar is only able to locate the files using absolute paths.
This is my configuration:
Am i missing some property that lets me avoid using ant for fixing paths?
The text was updated successfully, but these errors were encountered: