Plugin Information
This plugin allows you to capture code coverage report from Cobertura. Jenkins will generate the trend report of coverage. Configuring the Cobertura Plugin
Configuring build toolsHere are the configuration details for common build tools. Please feel free to update this with corrections or additions. Maven 2Quick configurationYou can either, enable "cobertura" analysis in your 'pom.xml' files or just tell Jenkins to run "cobertura" goal. If you don't want to change your pom files, just add the goal 'cobertura:cobertura' to your Maven project in Jenkins. Single ProjectIf you are using a single module configuration, add the following into your pom.xml. This will cause cobertura to be called each time you run "mvn package".
<project ...>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
...
</project>
Execute cobertura only from Jenkins using profilesYou can reduce the load of your developer machine by using maven profiles to execute the plugin only if you are running within Jenkins. The configuration below shows how to enable the plugin based on the information if maven was started by Jenkins. <project ...>
...
<profiles>
<!-- Jenkins by default defines a property BUILD_NUMBER which is used to enable the profile. -->
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<formats>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</project>
Project hierarchiesIf you are using a common parent for all Maven2 modules you can move the plugin configuration to the pluginManagement section of the common parent... <project ...>
...
<build>
...
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<formats>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</pluginManagement>
...
</build>
...
</project>
And add the plugin group and artifact to the children <project ...>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
...
</plugins>
...
</build>
...
</project>
Execute cobertura only from Jenkins using profilesIt is highly recommend to reduce the workload of the developers machines by disabling the cobertura plugin and only using it from within Jenkins. The following excerpt from the parent shows how to do so: <project ...>
...
<profiles>
<!-- Jenkins by default defines a property BUILD_NUMBER which is used to enable the profile. -->
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<formats>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
...
</project>
Now that your parent is only using the plugin management section if it is running from within Jenkins, you need the childern poms adapted as well: <project ...>
...
<!-- If we are running in Jenkins use cobertura. -->
<profiles>
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</project>
AntYou must first tell Ant about the Cobertura Ant tasks using a taskdef statement. The best place to do this is near the top of your build.xml script, before any target statements. <property name="cobertura.dir" value="C:/javastuff/cobertura" /> <path id="cobertura.classpath"> <fileset dir="${cobertura.dir}"> <include name="cobertura.jar" /> <include name="lib/**/*.jar" /> </fileset> </path> <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> You'll need to instrument the classes that JUnit will be testing (not the test classes themselves) as such: <cobertura-instrument todir="${instrumented.dir}"> <ignore regex="org.apache.log4j.*" /> <fileset dir="${classes.dir}"> <include name="**/*.class" /> <exclude name="**/*Test.class" /> </fileset> <fileset dir="${guiclasses.dir}"> <include name="**/*.class" /> <exclude name="**/*Test.class" /> </fileset> <fileset dir="${jars.dir}"> <include name="my-simple-plugin.jar" /> </fileset> </cobertura-instrument> Here's an example call to the JUnit ant task that has been modified to work with Cobertura.
<junit fork="yes" dir="${basedir}" failureProperty="test.failed"> <!-- Specify the name of the coverage data file to use. The value specified below is the default. --> <sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser" /> <!-- Note the classpath order: instrumented classes are before the original (uninstrumented) classes. This is important. --> <classpath location="${instrumented.dir}" /> <classpath location="${classes.dir}" /> <!-- The instrumented classes reference classes used by the Cobertura runtime, so Cobertura and its dependencies must be on your classpath. --> <classpath refid="cobertura.classpath" /> <formatter type="xml" /> <test name="${testcase}" todir="${reports.xml.dir}" if="testcase" /> <batchtest todir="${reports.xml.dir}" unless="testcase"> <fileset dir="${src.dir}"> <include name="**/*Test.java" /> </fileset> </batchtest> </junit> Finally, you need a task to generate the xml report, where 'destdir' is where you want the report (coverage.xml) generated. Your cobertura.ser is generated to your module root. srcdir is where your *.java files are located. If you use multiple modules in one build process you need to include the module name, if you use the simple srcdir parameter. It is not required to include module name if you use fileset. <cobertura-report format="xml" destdir="${coveragereport.dir}" srcdir="${src.dir}" /> You can use multiple source directories this way: <cobertura-report format="xml" destdir="${coveragereport.dir}" > <fileset dir="${src.dir.java}"> <include name="**/*.java" /> </fileset> <fileset dir="${src.dir.main}"> <include name="**/*.java" /> </fileset> </cobertura-report> GradleRunning Cobertura in gradle, copied from Piotr Gabryanczyk's post at http://piotrga.wordpress.com/2010/04/17/gradle-cobertura-integration-revisited/ and tweaked to work for gradle 1.5: Create cobertura.gradle in the root of your project: logger.info "Configuring Cobertura Plugin" configurations{ coberturaRuntime {extendsFrom testRuntime} } dependencies { coberturaRuntime 'net.sourceforge.cobertura:cobertura:1.9.4' } def serFile="${project.buildDir}/cobertura.ser" def classes="${project.buildDir}/classes/main" def classesCopy="${classes}-copy" task cobertura(type: Test){ dependencies { testRuntime 'net.sourceforge.cobertura:cobertura:1.9.4' } systemProperty "net.sourceforge.cobertura.datafile", serFile } cobertura.doFirst { logger.quiet "Instrumenting classes for Cobertura" ant { delete(file:serFile, failonerror:false) delete(dir: classesCopy, failonerror:false) copy(todir: classesCopy) { fileset(dir: classes) } taskdef(resource:'tasks.properties', classpath: configurations.coberturaRuntime.asPath) 'cobertura-instrument'(datafile: serFile) { fileset(dir: classes, includes:"**/*.class", excludes:"**/*Test.class") } } } cobertura.doLast{ if (new File(classesCopy).exists()) { //create html cobertura report ant.'cobertura-report'(destdir:"${project.reportsDir}/cobertura", format:'html', srcdir:"src/main/java", datafile: serFile) //create xml cobertura report ant.'cobertura-report'(destdir:"${project.reportsDir}/cobertura", format:'xml', srcdir:"src/main/java", datafile: serFile) ant.delete(file: classes) ant.move(file: classesCopy, tofile: classes) } } Apply Cobertura.gradle in your build.gradle Either (if single project build) apply plugin: 'java' apply from: 'cobertura.gradle' Or (if multi project build)
subprojects {
apply plugin: 'java'
apply from: "${parent.projectDir.canonicalPath}/cobertura.gradle"
}
Version HistoryVersion 1.9.7
Version 1.9.6
Version 1.9.5
Version 1.9.2 (9-Aug-2013)
Version 1.9.1 (14-Jun-2013)
Version 1.9 (28-Apr-2013)
Version 1.8 (15-Dec-2012)
Version 1.7.1 (17-Oct-2012)
Version 1.7 (11-Oct-2012)
Version 1.6 (17-Aug-2012)
Version 1.5 (20-May-2012)
Version 1.4 (5-May-2012)
Version 1.3 (13-Aug-2011)
Version 1.2 (25-Feb-2011)
Version 1.1 (11-Jan-2011)
Version 1.0 (30-Jul-2010)
Version 0.8.11 (22-Mar-2010)
Version 0.8.10 (15-Jan-2010)
Version 0.8.9 (8-Jul-2009)
Version 0.8.8 (11-Jun-2009)
Version 0.8.7 (4-Jun-2009)
Version 0.8.6 (7-May-2009)
Version 0.8.4 (21-Oct-2007)
Version 0.8.3 (12-Oct-2007)
Version 0.8.2 (4-Oct-2007)
Version 0.8.1 (28-Sep-2007)
Version 0.8 (20-Sep-2007)
Version 0.7 (20-Sep-2007)
Version 0.6 (20-Sep-2007)
Version 0.5 (20-Sep-2007)
Note that the conditional coverage is the highest coverage from all the cobertura reports aggregated in each build. Thus if you have two reports and one covers only 50% of a conditional and the other covers a different 25%, conditional coverage will be reported as 50% and not the 75% that you could argue it should be!
Version 0.4 (29-Aug-2007)
Version 0.3 (28-Aug-2007)
Version 0.2 (28-Aug-2007)
Version 0.1 (27-Aug-2007)
|
Cobertura Plugin
Skip to end of metadata
Go to start of metadata

Comments (64)
Sep 02, 2007
Anonymous says:
After some hours, I got it to work with the Netbeans makefile. The handling of...After some hours, I got it to work with the Netbeans makefile.
The handling of build.properties and project.properties was a bit tricky for me as a novice Ant user, because I don't wanted to "pollute" the other workstations in our working group with dependencies to cobertura. Besides, there seems to be a bug with the datafile attribute, which should define the position of cobertura.ser, but in fact this attribute doesn't work correctly.
I was a bit dissapointed about the graphical representation of the Cobertura report in the Hudson plugin, knowing the HTML report of Cobertura. Isn't there a possibility to let Cobertura produce the HTML report and put a link to it in Hudson?
But alltogether I became an entusiastic user of Hudson in the last four days! It's really an excellent tool.
Sep 20, 2007
Stephen Connolly says:
Could you please add a section into this page detailing how to get this plugin w...Could you please add a section into this page detailing how to get this plugin working with the Netbeans makefile?
Sep 23, 2007
jiai - says:
There is no magic with it. I've simply used the advices from this blog: http://w...There is no magic with it. I've simply used the advices from this blog: http://weblogs.java.net/blog/fabriziogiudici/archive/2006/11/setting_up_netb.html
If I have more time I'll post my configuration for findbugs, violations (pmd, findbugs, cpd, checkstyle) and cobertura. But it shouldn't be a problem with Fabrizios blog entry to make a suitable buildfile.
Sep 02, 2007
Anonymous says:
I agree with the previous poster -- the HTML reports generated by Cobert...I agree with the previous poster -- the HTML reports generated by Cobertura are great. My ANT file already generates those -- so what I want (in addition to the timeline graph) is to put a link to the coverage reports in my build status page. That has to be easy, right?
Sep 14, 2007
Anonymous says:
+1 for integrating the plain Cobertura reports in some way or another. The ...+1 for integrating the plain Cobertura reports in some way or another.
The plugin is great by the way
Sep 19, 2007
Stephen Connolly says:
The issue with integrating the plain Cobertura reports is that this plugin is ag...The issue with integrating the plain Cobertura reports is that this plugin is aggregating multiple cobertura reports, so I have to generate the HTML report by hand. The code for this is getting close to ready, but I was on holidays and have a backlog in work before I can get to it.
Sep 20, 2007
Stephen Connolly says:
See Version 0.5 which was released todaySee Version 0.5 which was released today
Sep 21, 2007
Anonymous says:
The HTML coverage report is produced now - but there is a problem: The plug...The HTML coverage report is produced now
- but there is a problem: The plugin doesn't include it! It seems to be that the plugin ist awaiting the HTML report in a "hard wired" directory named "cobertura" in the jobname-directory under jobs.
There should be a possibility to tell the plugin where the destination directory is - in the same way that you define the "Cobertura xml report pattern" in the project configuration.
At the moment I can't find out how to tell cobertura to use the hard-wired directory - but it is nearly midnight now.
Sep 21, 2007
Anonymous says:
It makes no difference if the report is in the cobertura directory or elsewhere:...It makes no difference if the report is in the cobertura directory or elsewhere: The plugin claims "Source code is unavailable". Two minutes past midnight now ...
Sep 22, 2007
Stephen Connolly says:
The source code will only be available for the most recent build. Disk spa...The source code will only be available for the most recent build. Disk space is cheap, but not cheap enough to save it for every build. Also, there is not much use in knowing the past source code coverage (and there is the method level coverage for such anyway)
If you are not seeing the source code for the most recent build, please file an issue and I'll have a look.
Sep 22, 2007
Anonymous says:
Perhaps I misunderstood what you meant - the report is produced and I can access...Perhaps I misunderstood what you meant - the report is produced and I can access it via the workspace hierarchy in hudson. But there is no link in the report itself. Where I assume it should be, in the detailed report generated by the plugin, there is only the text "Source code is unavailable".
Where can I file the issue - in the hudson issue tracker?
Sep 23, 2007
Stephen Connolly says:
Yes the issue tracker is the best place for it. The basic idea is that the plug...Yes the issue tracker is the best place for it.
The basic idea is that the plugin goes looking for the source code in all the places that cobertura says it could have been. If it did not find the source code then you won't see it.
what version of cobertura are you using (most of my testing is with 1.9)
Sep 23, 2007
jiai - says:
I've filed it as https://hudson.dev.java.net/issues/show_bug.cgi?id=846I've filed it as https://hudson.dev.java.net/issues/show_bug.cgi?id=846
Oct 11, 2007
Anonymous says:
The plugin does not work. I have Cobertura successfully generating both HTML and...The plugin does not work. I have Cobertura successfully generating both HTML and XML reports as part of the build. I have the XML pattern set in the plugin configuration and it's able to find it successfully. But that's where the magic stops.
Here is the output from the log:Recording test results
Publishing Cobertura coverage report...
Publishing Cobertura coverage results...
FATAL: /local/bamboo/.hudson/jobs/MYJOB/cobertura/com/foo/dec/framework/dataAccessServices (Is a directory)
java.io.FileNotFoundException: /local/bamboo/.hudson/jobs/MYJOB/cobertura/com/foo/dec/framework/dataAccessServices (Is a directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at hudson.FilePath.write(FilePath.java:600)
at hudson.plugins.cobertura.renderers.SourceCodePainter.paintSourceCode(SourceCodePainter.java:48)
at hudson.plugins.cobertura.renderers.SourceCodePainter.invoke(SourceCodePainter.java:127)
at hudson.plugins.cobertura.renderers.SourceCodePainter.invoke(SourceCodePainter.java:28)
at hudson.FilePath.act(FilePath.java:280)
at hudson.plugins.cobertura.CoberturaPublisher.perform(CoberturaPublisher.java:250)
at hudson.model.Build$RunnerImpl.post2(Build.java:138)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:244)
at hudson.model.Run.run(Run.java:597)
at hudson.model.Build.run(Build.java:103)
at hudson.model.ResourceController.execute(ResourceController.java:66)
at hudson.model.Executor.run(Executor.java:62)
Oct 21, 2007
Anonymous says:
Have you filed an issue with respect to this? The best way to get attention is ...Have you filed an issue with respect to this?
The best way to get attention is to file an issue or post on the mailing list.
Oct 24, 2007
Anonymous says:
Recenty, I am getting the following error when displayng the graph@: Status Cod...Recenty, I am getting the following error when displayng the graph@:
Status Code: 500
Exception:
Stacktrace: java.lang.LinkageError: hudson/util/ChartUtil
at hudson.plugins.cobertura.targets.CoverageResult.doGraph(CoverageResult.java:298)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:103)
at org.kohsuke.stapler.Function.bindAndinvoke(Function.java:59)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:63)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:294)
at org.kohsuke.stapler.MetaClass$15.dispatch(MetaClass.java:361)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:294)
at org.kohsuke.stapler.MetaClass$7.doDispatch(MetaClass.java:208)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:294)
at org.kohsuke.stapler.MetaClass$9.doDispatch(MetaClass.java:240)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:294)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:231)
at org.kohsuke.stapler.Stapler.service(Stapler.java:79)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
at winstone.ServletConfiguration.execute(ServletConfiguration.java:249)
at winstone.RequestDispatcher.forward(RequestDispatcher.java:335)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:378)
at hudson.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:79)
at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244)
at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
at java.lang.Thread.run(Unknown Source)
Any ideas what maybe wrong?
Oct 24, 2007
Anonymous says:
PRETTY PLEASE WITH CATNIP ON TOP! File an issue Or at least post your ques...PRETTY PLEASE WITH CATNIP ON TOP!
File an issue
Or at least post your question on the mailing list
Nobody is watching this comments section
Oct 31, 2007
Anonymous says:
The instructions above say that examples for maven and ant are below. I don't se...The instructions above say that examples for maven and ant are below. I don't see any such examples. Maybe they could be more attention-getting. thanks.
Nov 02, 2007
Anonymous says:
i second that.i second that.
Nov 16, 2007
Stephen Connolly says:
MORE PRETTY PLEASE WITH EXTRA CATNIP ON TOP! This is a Wiki. If you s...MORE PRETTY PLEASE WITH EXTRA CATNIP ON TOP!
This is a Wiki. If you spot something that is incorrect, please correct it. If you spot something that is missing, please add it. If you spot something that should be there but is not, please add a placeholder.
Mar 27, 2008
Mike Haller says:
Stephen, i tried to query the issue tracker but no luck. The dev.java.net issue ...Stephen, i tried to query the issue tracker but no luck. The dev.java.net issue tracker is very unusable. Userfriendlyness equals zero.
According to the current version of SourceCodePainter in source control, there have already been changes. Do you know the cause of the FileNotFound Exception or how to circumvent this issue?
Dec 12, 2007
Mike Caron says:
Just started using this. Really cool work, but it seems like the HTML reports ge...Just started using this. Really cool work, but it seems like the HTML reports gen'd by the plugin always report 100%, even though the weather is accurate and the file view reports correct red and green lines. I became an observer so that I could grab the code and work on it. I also like the idea of linking the "Coverage Report" to the original HTML reports, so I was going to do that too. Of course, I'd provide patches. But I first need code access...
Jun 02, 2008
fabrice says:
I use Hudson ver. 1.219 and I verified my cobertura config matches this on ...I use Hudson ver. 1.219 and I verified my cobertura config matches this on this webpage, HTML and XML files are generated in target/site/cobertura but there is no image generated on the job page, no link which allow me to see cobertura reports and trends.
I think it is a bug.
Jun 03, 2008
muanis - says:
Just updated hudson to 1.220, cobertura plugin version 0.8.4 Build ok, coverage...Just updated hudson to 1.220, cobertura plugin version 0.8.4
Build ok, coverage.xml being generated just as expected in this tutorial. but I get no image nor link on the status page.
No kind of errors in the log file.
Any ideas where I can find information to help finding this bug?
Jun 04, 2008
fabrice says:
ouf I am not alone on this new problem help usouf I am not alone on this new problem
help us
Jun 04, 2008
muanis - says:
Fabrice, I've checked out version 0.8.5-SNAPSHOT and its working. ...Fabrice,
I've checked out version 0.8.5-SNAPSHOT and its working.
But anyway, the coverage reports only apper at module page
Jun 05, 2008
fabrice says:
Ok nice It would be nice too if we have a new stable release. When ?Ok nice
It would be nice too if we have a new stable release. When ?
Apr 01, 2009
Natalie Vaslavsky says:
Jose, I have the same problem " Build ok, coverage.xml being generated just as...Jose,
I have the same problem "
Build ok, coverage.xml being generated just as expected in this tutorial. but I get no image nor link on the status page."
I use cobertura plugin version 0.8.4.
Have you bee able to solve?
Jun 18, 2008
truong van nga says:
Hi, have you some news about a stable release of this plugin? I can only downlo...Hi, have you some news about a stable release of this plugin?
I can only download the 0.8.4 which is not working
the report don't appear on the web site (but my coverage.xml are generated)
Is the 0.8.5-SNAPSHOT always available? and where?
Jun 26, 2008
niiico - says:
Hi, I have the same issue plus another one. I have a main project with lots of ...Hi, I have the same issue plus another one.
I have a main project with lots of sub-projects. I configured only one job for the main project (using maven2) and it calls allthe sub modules. Great. But I want the cobertura reports generated without running the tests twice.
If I call the goal "install", cobertura is not run. If I run "cobertura:cobertura", some modules are tested with some old dependencies since some new packages haven't been "installed" in the repository. "install cobertura:cobertura" works, but it runs tests twice.
What am I doing wrong?
Thanks for your hints
Sep 17, 2008
Ramil Israfilov says:
Hi, in order to execute cobertura during test phase just add following in your r...Hi,
in order to execute cobertura during test phase just add following in your root pom.xml file
<groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.2</version> <executions> <execution> <phase>test</phase> <goals> <goal>cobertura</goal> </goals> </execution> </executions> </groupId>After that cobertura task will be executed during test phase.
But how to avoid execution of tests twice I don't know.
Dec 02, 2008
skaze - says:
Is there any plans to make this work with the built-in maven 2 project type? doh...Is there any plans to make this work with the built-in maven 2 project type? doh, its already there! its just that i'm running a custom cobertura mojo called report-only and that was being detected by the hudson cobertura plugin. reports don't seem aggregated though...
Jan 08, 2009
Dmitry Kudryavtsev says:
Hello. I've discovered that plugin doesn't work correctly if your build is unst...Hello.
I've discovered that plugin doesn't work correctly if your build is unstable. For example if some of your unit tests failed then you got "Source code is unavailable" message although all reports are gathered and you can see coverage rate. Global link to cobertura report also would be broken or invalid because you may not have any live stable build or you last stable build is not actual
So I looked into code and noticed that method isSourceFileAvailable in CoverageResult.class looks like "... owner == owner.getProject().getLastStableBuild() && blah-blah-blah ...".
I think this is not really good, because in TDD you always have some errors in tests, so you would never see source code.
Maybe it is better to change code of isSourceFileAvailable to something like "...getProject().getLastSuccessfulBuild()..." and also fix urls that is generated by CoberturaProjectAction.class ?
I would like to contribute patch but I'm not sure how to do it.
And sorry for my bad English - it is not my native language.
Mar 11, 2009
witek says:
There is a way to avoid doubled testing. We have added new "generate-report" goa...There is a way to avoid doubled testing. We have added new "generate-report" goal to cobertura-maven-plugin, so you can instrument code before tests and generate xml report when tests (or integration-tests) phase is finished. See top.touk.pl
Apr 16, 2009
Brian Lalor says:
Have you released this modified plugin? I'm not able to find any more informatio...Have you released this modified plugin? I'm not able to find any more information on top.touk.pl than what's in your blog post there.
Mar 04, 2010
thedug - says:
Doesn't seem to be available anymore?Doesn't seem to be available anymore?
Apr 02, 2009
Daniel Rudman says:
Hi, I am using Maven2/SVN and the latest Hudson Cobertura plugin 0.8.5. I have t...Hi,
I am using Maven2/SVN and the latest Hudson Cobertura plugin 0.8.5. I have the coverage report generated and all the settings set correctly, but I do not see the coverage report in Hudson either in the job or module pages. No errors in the log either. Any ideas of how else I can debug? Pretty much stuck.
Thanks!
Apr 09, 2009
Natalie Vaslavsky says:
What version of Hudson can be used with cobertura plugin 0.8.5. I have 1.226. ...What version of Hudson can be used with cobertura plugin 0.8.5.
I have 1.226.
I have a hudson error while configuring a project.
Thanks
May 14, 2009
Joaquin Morcate says:
Hi, I'm using Hudson 1.304 and Cobertura plugin 0.8.6. In my build.xml fi...Hi,
I'm using Hudson 1.304 and Cobertura plugin 0.8.6. In my build.xml file I have the following that works fine when I build from the command line but it keeps on complaining about the task definition when is build by hudson. Any idea? Thank you.
<property name="cobertura.dir" location="/usr/share/tools/cobertura-1.9.1" /> <path id="cobertura.classpath"> <fileset dir="${cobertura.dir}"> <include name="cobertura.jar" /> <include name="lib/**/*.jar" /> </fileset> </path> <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />Jul 09, 2009
adamarmistead - says:
Hello, I'm using Hudson 1.34 and Cobertura plugin 0.8.9 with Maven 2. Whe...Hello,
I'm using Hudson 1.34 and Cobertura plugin 0.8.9 with Maven 2. When hudson builds the coverage.xml files they are corrupted. If I build my project in my IDE they are fine. Here is an example of they look like when hudson builds them.
It produces a coverage.xml file and several coverage#.xml files where the # is a number 1-10. Some of the numbered files appear to be more or less mangled copies of some of my .java files. It puts them in the .hudson/jobs/<MyProject>/builds/<Current build date and time> directory and then fails the build saying it can't parse them, which is no surprise. I have tried putting my cobertura plugin config stuff in my build tags or in my reporting tags or in both places in my pom, I have even just cut and pasted the config at the top of this page for the Single Project type and it all comes out the same. It does however work correctly with the maven "site" goal both with html and xml. Anyone know what I'm doing wrong that makes it not work with hudson?
Jul 15, 2009
Christoph Brill says:
I have the same issues. The cobertura plugin seems to copy everything from the s...I have the same issues. The cobertura plugin seems to copy everything from the source directory ... even the stuff from my ".git"-SCM directory (I found a hook as coverage8.xml). I think 0.8.9 is bugged.
Edit:
Maybe hudson is bugged? I downgraded to 0.8.7 and the problem still persists. I'm running Hudson 1.315.
Oct 12, 2009
John Bolton says:
We have two build machines running Hudson, one Linux (openSUSE) and the other Wi...We have two build machines running Hudson, one Linux (openSUSE) and the other Windows 2003. The plug-in works great on Linux, but it does not work on Windows. In fact, it causes the builds to fail. Both build machines are configured with the same version of the various components used.
We're using version 1.326 of Hudson, Maven version 2.2.1, JDK 1.6 update 16, and version 0.8.9 of this plug-in.
We have a parent POM that references child POM's via the <modules/> tag.
Does anybody have any ideas why this is crashing?
Thanks for your time,
John
Jan 13, 2010
John Bolton says:
FYI, I reinstalled the OS and all of the software. The problem has gone away. I'...FYI, I reinstalled the OS and all of the software. The problem has gone away. I'm not sure what caused the problem however I don't believe the plug-in was doing anything wrong.
Dec 03, 2009
Chris Moesel says:
I've noticed that this plug-in shows method coverage stats -- but cobert...I've noticed that this plug-in shows method coverage stats -- but cobertura html reports don't show method coverage. I also don't see any explicit method coverage stats in the cobertura xml file. How are you getting method coverage? Are you getting it by looking at each method element in the report and generating those stats yourself?
Dec 04, 2009
davidmc24 - says:
Yes, I believe that the plug-in is doing its own aggregation of results. T...Yes, I believe that the plug-in is doing its own aggregation of results. This allows it to take multiple independent coverage.xml files and provide a single unified view of the coverage.
Apr 22, 2010
Peter Kreidermacher says:
Hi, I've been running the cobertura plugin in Hudson for a couple of weeks now ...Hi,
I've been running the cobertura plugin in Hudson for a couple of weeks now with no issues. All of a sudden, this morning, builds that were building correctly started failing. Looking in the console output it turns out that Hudson could not find the cobertura plugin. Nothing has changed as far as setup and configuration. I've tried disabling and enabling (with Hudson restarts) but cobertura is still not recognized by Hudson.
Does anyone have any idea why this started to happen all of a sudden?
Thanks!
Apr 26, 2010
Stubbs - says:
There seem to be 2 styles of graph available from the Cobetura plugin, for proje...There seem to be 2 styles of graph available from the Cobetura plugin, for projects that have multiple Maven modules you get to see a trend over time, but if the project on has a single module, I get a bar chart that shows me the coverage for the last build.
Is there any way to always display the trend graph?
Oct 15, 2010
mallox - says:
I'm trying to get coverage Information across two modules, meaning one module (a...I'm trying to get coverage Information across two modules, meaning one module (a test module) is running tests on the other module.
Unfortunately the cobertura plugin here doesn't consider cross module test coverage... or at least I haven't figured out how. I've already tried moving the configuration to the parent pom, but alas, no luck.
Any ideas how this could be done?
Thanks
Mar 01, 2011
Daniel Kirkdorffer says:
The information for this plugin at Hudson now reads: Moved to Jenkins This pl...The information for this plugin at Hudson now reads:
As a user this doesn't give me a warm fuzzy that the plugin will continue to be compatible with Hudson. Can you confirm? Thanks.
Mar 01, 2011
Daniel Kirkdorffer says:
The coverage report doesn't list packages or files in alphabetical order which m...The coverage report doesn't list packages or files in alphabetical order which makes it difficult to find a package or class. Could this be changed or made configurable? Or the column sortable?
Thanks.
Nov 17, 2011
Bill Medland says:
When accessing the api\xml report the element result only includes the ratio. &n...When accessing the api\xml report the element result only includes the ratio. Could it also include the numerator and denominator so that consumers can sensibly combine them across jobs (without having to get the details)?
Mar 20, 2012
Chris Watts says:
We have it set up to run the code coverage via the cobertura:cobertura which wor...We have it set up to run the code coverage via the cobertura:cobertura which works well except when we do a release.
As the release is run calls maven with mvn release:prepare release:perform - it doesn't execute the cobertura (which is what we want). The build goes through to the very end and then fails the build (after successfully uploading all the artifacts) with below.
Any ideas how to stop it failing the build? Or just raise a jira?
INFO Deployment done in 1.8 sec
Publishing Cobertura coverage report...
No coverage results were found using the pattern '**/target/site/cobertura/coverage.xml' relative to '/tmp/hudson_slave/workspace/trunk'. Did you enter a pattern relative to the correct directory? Did you generate the XML report(s) for Cobertura?
Build step 'Publish Cobertura Coverage Report' changed build result to FAILURE
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
Apr 04, 2012
Mike Petterson says:
I checked the the source code tree under .../jobs/<myjob>/cobertura/se/......I checked the the source code tree under .../jobs/<myjob>/cobertura/se/....
and found that it has not been changed for a while. Anyone with a similair experience?
//mike
May 19, 2012
- - says:
May I suggest updating the version of the Cobertura plugin in the POM example? T...May I suggest updating the version of the Cobertura plugin in the POM example? The problem is 2.2 seems to have bugs with coverage detection - being new to Cobertura, I've spent 2+ hours trying to solve the problem, which turned out to be as easy as changing the Maven plugin version to 2.5.1 (the latest at the time of writing).
I don't want to edit the page myself, as I don't know whether 2.5.1 is actually the recommended version for this Jenkins plugin.
May 29, 2012
Roman G says:
Hi, I want to use cobertura plugin for gcov data on c files. But generated cober...Hi,
I want to use cobertura plugin for gcov data on c files. But generated cobertura report shows java specific entities - "packages", "classes". Is it possible to somehow simple remove these metrics from report?
Mar 13, 2013
Ajith Thampi says:
Request to add a Build Setter compatibility (or Token Macros) name to all refere...Request to add a Build Setter compatibility (or Token Macros) name to all references to a job.
I currently have my Build Setter named to a pipeline number, and hence require Cobertura reports to point to that rather than an Hudson Job number.
Thanks for the awesome cobertura integration though.
Cheers!
Jul 10, 2013
Franck LEVEQUE says:
Hi, I would like to only show the configured metrics in the Code coverage graph...Hi,
I would like to only show the configured metrics in the Code coverage graph. I only defined three (classes, methods and lines) but it display all the metrics (Packages, Files, Classes, Methods, Lines, and Conditionals)
Is it possible to do with the current version (1.9.1) or can you add the option in future release ?
Anyway, thanks for your great plugin.
Nov 07, 2013
Angelo Cordova says:
Hi I´ve just installed version 1.9.3 and I think I've found a bug or something...Hi
I´ve just installed version 1.9.3 and I think I've found a bug or something like that.
In the advanced configurations options I can change the "health history" (sun, cloud, rain, storm) of a project, based on coverage percentage of classes, packages, methods, lines, etc.
For my project, I set "sunny" 70%, and "stormy" 10% of lines coverage. I had 69% of lines coverage, so I was expecting to get a "cloud" (or "rain" at most), but I got "storm".
I thought the health could be interpolated, based on max. and min. values.
Mar 19, 2014
Mallikarjun Ch says:
I want to exclude sub project in cobertura.gradle from cobertura task in G...I want to exclude sub project in cobertura.gradle from cobertura task in GRADLE . I tried to exclude/skip as below. But no Luck. Please share the right way of excluding sub project in cobertura.gradle asap. I stuck here-----------------------------------
coberturaTask.enabled = false
********AND************
project('test-modules:functional-tests') {
cobertura
}
Mar 19, 2014
Mallikarjun Ch says:
I want to exclude sub project in cobertura.gradle from cobe...I want to exclude sub project in cobertura.gradle from cobertura task in GRADLE . I tried to exclude/skip as below. But no Luck. Please share the right way of excluding sub project in cobertura.gradle asap. I stuck here-----------------------------------
coberturaTask.enabled = false
********AND************
project('test-modules:functional-tests') {
cobertura
}
May 07, 2014
pset suntec says:
I want to show gcov result by cobertura, and my xml generated by gcovr as follow...I want to show gcov result by cobertura, and my xml generated by gcovr as follows, the "name="api">" link to covertura api path, how can i solve this issue?
<?xml version="1.0" ?>
<!DOCTYPE coverage
SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
<coverage branch-rate="0.0" line-rate="0.00923787528868"
timestamp="1399387640" version="gcovr 3.1-prerelease">
<sources>
<source>/p/jenkins/workspace/UIFramework_UnitTest/framework/service/WidgetService/</source>
</sources>
<packages>
<package branch-rate="0.0" complexity="0.0" line-rate="0.00943396226415"
name="api">
<classes>
<class branch-rate="0.0" complexity="0.0"
filename="api/AWidgetApiHandler.cpp" line-rate="0.0"
name="AWidgetApiHandler_cpp">
<methods/>
<lines>
<?xml version="1.0" ?>
<!DOCTYPE coverage
SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
<coverage branch-rate="0.0" line-rate="0.00923787528868"
timestamp="1399387640" version="gcovr 3.1-prerelease">
<sources>
<source>/p/jenkins/workspace/UIFramework_UnitTest/framework/service/WidgetService/</source>
</sources>
<packages>
<package branch-rate="0.0" complexity="0.0" line-rate="0.00943396226415"
name="api">
<classes>
<class branch-rate="0.0" complexity="0.0"
filename="api/AWidgetApiHandler.cpp" line-rate="0.0"
name="AWidgetApiHandler_cpp">
<methods/>
<lines>
May 28, 2014
Kevin Horejs says:
I was looking through the history of the updates and it explicitly says when the...I was looking through the history of the updates and it explicitly says when the plugin was updated to work with JDK 5 and 6. I was wondering if the current plugin works with JDK 7. I know people are using it but it seems to have a good many problems. So does it actually work with Java 7, or are people just finding work-arounds for the problems they run into? Also what are the dependent versions of Jenkins, Maven, and Cobertura needed for the current plugin? (1.9.5) Thank You
Jul 23, 2014
Gunanand Nagarkar says:
I am using it for Java code and want to know if there is way of configuring for ...I am using it for Java code and want to know if there is way of configuring for email notification when the coverage (for java package/s) is less than what it was in the previous build.
Jan 16, 2015
Jackey Cheung says:
Is there a way to use custom title/label instead of the default "Code Coverage"?...Is there a way to use custom title/label instead of the default "Code Coverage"?
I generate reports from PHP and JS in my project, and there's no way to customize the title/label of the generated output.
I'm so confused every time I see two reports with the same title/label listed one next to other.
Add Comment