Clover jenkins plugin link "Coverage report" returns "http 404 error"
Asked by will zhang:

Hi,

I'm using the clover-plugin on Jenkins to show code coverage result. Since I'm not using ant build, I followed the "Manually configuring the Clover plugin instruction" on this page <https://wiki.jenkins-ci.org/display/JENKINS/Clover+Plugin>. My jenkins job will use the command line tools to generate xml file for the plugin.   

After the configuration is done and job finished without errors, the link "coverage report seems not working.

Any idea?

<br />

here is what it looks like:

Screen Shot 2016-08-31 at 12.45.53 PM.pngScreen Shot 2016-08-31 at 12.47.27 PM.png

[](https://community.atlassian.com/t5/Confluence-questions/Clover-jenkins-plugin-link-quot-Coverage-report-quot-returns/qaq-p/162899?attachment-id=12329){#link_11866f7e3109f1}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/27279/1/Screen%20Shot%202016-08-31%20at%2012.45.53%20PM.png){#display_11866f7e3109f1_0}  
[](https://community.atlassian.com/t5/Confluence-questions/Clover-jenkins-plugin-link-quot-Coverage-report-quot-returns/qaq-p/162899?attachment-id=12330){#link_11866f7e3109f1_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/27279/2/Screen%20Shot%202016-08-31%20at%2012.47.27%20PM.png){#display_11866f7e3109f1_2}


Answers:
author: will zhang
body: Figured it out, need to generate html report the same directory of xml.

Thanks for the help!


author: will zhang
body: Hi Marek,

Another issue came out after couple runs of my code coverage build on jenkins.

The code coverage tracking graph is gone.

The summary line of each job shows this: "Clover Code Coverage - null% method null, conditional null, statement null. "

Clicking on " [Clover Summary Report](http://nsbu-jenkins.nicira.eng.vmware.com/job/nsx-code-coverage-ccp-unit/43/clover)" give me an exception as below:

```
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2234)	at com.google.common.cache.LocalCache.get(LocalCache.java:3965)	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969)	at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829)	at hudson.plugins.clover.CloverBuildAction.getResult(CloverBuildAction.java:162)	at hudson.plugins.clover.CloverBuildAction.getTarget(CloverBuildAction.java:111)	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:674)	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)	at org.kohsuke.stapler.MetaClass$13.dispatch(MetaClass.java:411)	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)	at org.kohsuke.stapler.MetaClass$13.dispatch(MetaClass.java:411)	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)	at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)	at com.cloudbees.jenkins.support.slowrequest.SlowRequestFilter.doFilter(SlowRequestFilter.java:37)	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)	at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:46)	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)	at 
```

By digging into jenkins log, I found the exception message:

Sep 02, 2016 9:50:41 AM hudson.ExpressionFactory2$JexlExpression evaluate

WARNING: Caught exception evaluating: it.elementCoverage in /job/nsx-code-coverage-ccp-unit/43/. Reason: java.lang.reflect.InvocationTargetException

Is this path correct?

By looking into github code, I pinned down the problem to this line:

<https://github.com/jenkinsci/clover-plugin/blob/master/src/main/java/hudson/plugins/clover/CloverPublisher.java>

```
static File getCloverXmlReport(Run&lt;?, ?&gt; build) {        return new File(build.getRootDir(), "clover.xml");    }
```

Is build.getRootDir() the right way to get correct path for clover.xml?

Thanks,

Will


author: Marek Parfianowicz
body: > My jenkins job will use the command line tools to generate xml file for the plugin.

Did you create an HTML report too?

The XML file is used to parse coverage statistics and to show the coverage bar for a build.

If you want to browse code coverage for your source files, then you have to generate also the HTML report.

comments: author: will zhang
body: Yes, I have the html report generated too. Where should I put this html report so that the content got load by this link?

About the content security policy, I think it's not relevant since I didn't even see "loading dashboard.html..."

Thanks,

Will


author: will zhang
body: There was a IOException during this plugin gets run:

```
Publishing Clover coverage report...Publishing Clover XML report...IOException when checking workspace path:remote file operation failed: /var/jenkins-test/workspace/nsx-code-coverage-mp-review at hudson.remoting.Channel@b718b9c:colibri-code-coverage-slave2-test: java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper@774508f3Publishing Clover coverage results...
```


author: Marek Parfianowicz
body: I think you have the problem similar to described on the <https://wiki.jenkins-ci.org/display/JENKINS/Clover+Plugin> page, chapter *Viewing the report*:

> Jenkins 1.641 introduced content security policy, which blocks any active content in published artficats. As a result, when you click on the link, it will display the "Loading dashboard.html..." message instead of the report. In order to fix it, you must relax the policy to allow JavaScript, CSS and images. See <https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy> for more details.


Tags: clover

clover-html-report

jenkins