Clover jenkins plugin link "Coverage report" returns "http 404 error"

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?


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

 

4 answers

Figured it out, need to generate html report the same directory of xml.

 

Thanks for the help!

0 vote

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.
0 vote

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.

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

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@774508f3
Publishing Clover coverage results...

 

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" 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<?, ?> build) {

        return new File(build.getRootDir(), "clover.xml");

    }

 

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

 

 

Thanks,

Will

 

 

 

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

805 views 23 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you