Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Monday, May 30, 2016

Maven Cobertura plugin not generating coverage.xml

Maven Cobertura plugin not generating coverage.xml


I am trying to generate a coverage.xml so that I can reference it in Cobertura plugin of Hudson, but the file is not being created.

I've added the following to my POM

                               org.codehaus.mojo              cobertura-maven-plugin              2.5.1                                                    html                     xml                                                   

After running mvn cobertura:cobertura, the HTML site is generated as expected at **\target\site\cobertura, but coverage.xml is nowhere to be found. What am I missing/misunderstanding?

I am running Maven 3.0.3

Answer by kjl for Maven Cobertura plugin not generating coverage.xml


I'm still quite a novice with the connections between Maven Plugins and Hudson and it's plugins - so this isn't an intelligent answer by any means, but help on Google is very few and far between for this issue - so hopefully it helps someone in the future.

After spending a few more hours of tinkering with settings, I've found that the coverage.xml simply doesn't seem to be built locally.

This is the combination that got it working:

  1. I had changed my version to 2.2 in my POM (I was getting resource not found errors from Apache with 2.5.1)
  2. Added cobertura:cobertura in my Hudson goal
  3. Set the Cobertura coverage pattern to the recommended **/target/site/cobertura/coverage.xml

Answer by FrVaBe for Maven Cobertura plugin not generating coverage.xml


I put the plugin in the build section and it works:

                              org.codehaus.mojo              cobertura-maven-plugin              2.5.1                                                      html                      xml                                                    

The reporting section and its differences to the plugin section are described here. I don't know if this is a maven [3.0.4] or cobertura-plugin issue.

Answer by Sreedhar GS for Maven Cobertura plugin not generating coverage.xml


Add below lines to your application Goals:(configure section of the application in jenkins)

cobertura:cobertura -Dcobertura.report.format=xml  

pom.xml changes:

                  org.codehaus.mojo          cobertura-maven-plugin          2.6                                          html                  xml                                  

Answer by Jeff Fairley for Maven Cobertura plugin not generating coverage.xml


I have the same issue using 2.6 of the plugin.

I found that when I specify both types, I only got html.

                            html                 xml               

But when I specify only xml, I get an xml report.

                            xml               

This is probably a bug in the plugin.

Another user suggested creating two executions. I tried that with no success (meaning I got html, but not xml).

Answer by Jimmy for Maven Cobertura plugin not generating coverage.xml


Update your POM file as

                  org.codehaus.mojo          cobertura-maven-plugin          2.7                                          html                  xml                                  

This worked out for me: Probable reason it contanis the latest version of cobertura-maven-plugin (2.7)


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.