wakaleo / game-of-life

Demo application for the 'Jenkins: The Definitive Guide' book
http://www.wakaleo.com/books/jenkins-the-definitive-guide
2.04k stars 19.93k forks source link

Coverage report not there #14

Open tfm64 opened 11 years ago

tfm64 commented 11 years ago

I'm trying to follow the book. Maven version 3.0.4. I'm getting the following warnings:

[WARNING] Some problems were encountered while building the effective model for com.wakaleo.gameoflife:gameoflife-core:jar:0.9.67-SNAPSHOT [WARNING] 'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-project-info-reports-plugin is missing. @ line 16, column 21

and

[WARNING] The POM for org.easyb:maven-easyb-plugin:jar:1.5 is missing, no dependency information available

but the following is very strange.

Cobertura: Loaded information on 2 classes. Report time: 174ms

[INFO] Cobertura Report generation was successful. [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] gameoflife ........................................ SUCCESS [4.259s] [INFO] gameoflife-build .................................. SUCCESS [0.833s] [INFO] gameoflife-core ................................... SUCCESS [3.581s] [INFO] gameoflife-web .................................... SUCCESS [2.567s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 13.657s [INFO] Finished at: Wed Dec 19 05:11:59 CET 2012 [INFO] Final Memory: 18M/45M [INFO] ------------------------------------------------------------------------ Publishing Javadoc Recording test results CodeCover: looking for coverage reports in the provided path: **/target/site/cobertura/coverage.xml CodeCover: no coverage files found in workspace. Was any report generated? Build step 'Record CodeCover coverage report' changed build result to FAILURE

Any ideas?

dduck commented 11 years ago

I am having the same issue. Any ideas?

EivindEE commented 11 years ago

He has modified the pom to only report when you invoke -Pmetrics. He explains it on page 179. I just spent two days trying to generate it. Change the line to:

javadoc:javadoc cobertura:cobertura -Pmetrics

and it should work.

rachelo commented 11 years ago

I am running into the same issue. I have changed my line to: javadoc:javadoc cobertura:cobertura -Pmetrics and I am still getting this warning:

[WARNING] [WARNING] Some problems were encountered while building the effective model for com.wakaleo.gameoflife:gameoflife-core:jar:0.9.67-SNAPSHOT [WARNING] 'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-project-info-reports-plugin is missing. @ line 16, column 21 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING]

Is there something key I'm missing?

technorat commented 11 years ago

I have the same problem too..Any solutions?

wakaleo commented 11 years ago

The warning shouldn't stop the build working correctly.

On 13 March 2013 20:30, technorat notifications@github.com wrote:

I have the same problem too..Any solutions?

— Reply to this email directly or view it on GitHubhttps://github.com/wakaleo/game-of-life/issues/14#issuecomment-14831709 .


John Smart | Wakaleo Consulting | +61 407 247 642 Optimizing your software development process http://www.wakaleo.com | john.smart@wakaleo.com

faonur commented 10 years ago

I am having similar problem. coverage.xml is not created. And, I am getting the following error.

[ERROR] Oct 30, 2013 1:36:07 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData INFO: Cobertura: Loaded information on 2 classes.

[INFO] Cobertura Report generation was successful. [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] gameoflife ........................................ SUCCESS [3.960s] [INFO] gameoflife-build .................................. SUCCESS [0.480s] [INFO] gameoflife-core ................................... SUCCESS [3.416s] [INFO] gameoflife-web .................................... SUCCESS [3.198s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.495s [INFO] Finished at: Wed Oct 30 13:36:08 GMT 2013 [INFO] Final Memory: 29M/349M [INFO] ------------------------------------------------------------------------ [Cobertura] Publishing Cobertura coverage report... [Cobertura] No coverage results were found using the pattern '**/target/site/cobertura/coverage.xml' relative to 'C:.jenkins\jobs\gameoflife-default\workspace'. 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 Recording test results Publishing Javadoc Finished: FAILURE

phutchins commented 10 years ago

I've been stuck on this problem for days and am now getting quite frustrated at the book and that there is no clear fix for this. I'm using the "javadoc:javadoc cobertura:cobertura -Pmetrics" options as explained before which does not help.

I'm on Jenkins 1.540 Maven 3.1.1

Any thoughts??

I'm getting this: [ERROR] Nov 18, 2013 8:32:04 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData [ERROR] Nov 18, 2013 8:32:07 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData

[Cobertura] Publishing Cobertura coverage report... [Cobertura] No coverage results were found using the pattern '**/target/site/cobertura/coverage.xml' relative to '/var/lib/jenkins/workspace/game-of-life-default'. 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 Finished: FAILURE

wakaleo commented 10 years ago

It looks like the Maven Cobertura plugin is extremely buggy with more recent versions of Maven (possibly). The documented configuration doesn't work. The workaround is to use jacoco instead of cobertura. Jacoco is run automatically when you run "mvn verify". In Jenkins, you can use the Jacoco plugin (https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin). To configure this plugin, use the following values:

Path to exec files: /target/.exec Path to class directories: _/target Path to source directories: src/main/java Exclusions: _/When*

phutchins commented 10 years ago

Awesome, this worked first run!! I really appreciate the quick reply. Been stuck on this for a bit and didn't want to move any further in my book until I got past this. :) It didn't find any exec files however so I'm playing around with the path settings... I dont' see any .exec files in /target so i'm trying /target/.exec which seems to work and finds 3 exec's but Im not sure what the lines mean... Also, does the \ mean any directory?

jason-azze-cdna commented 10 years ago

For Path to exec files: I needed **/target/.exec

Otherwise JaCoCo complains about "Expecting Ant GLOB pattern"

striker88 commented 10 years ago

I have used the following in the post build action section to configure the Jacoco Coverage Report and it seems, it is working. Path to exec files: */target/.exec Path to class directories: *_/target Path to source directories: /src/main/java inclusions: */.class Exclusions: */When_

pavannaganna commented 10 years ago

I am still not able to build it successfully. I still face below error [ERROR] Sep 06, 2014 9:46:54 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverage

INFO: Cobertura: Loaded information on 2 classes.

[INFO] Cobertura Report generation was successful. [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] gameoflife ........................................ SUCCESS [2.961s] [INFO] gameoflife-build .................................. SUCCESS [0.590s] [INFO] gameoflife-core ................................... SUCCESS [0.993s] [INFO] gameoflife-web .................................... SUCCESS [0.959s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.244s [INFO] Finished at: Sat Sep 06 21:46:55 CDT 2014 [INFO] Final Memory: 23M/167M [INFO] ------------------------------------------------------------------------ [Cobertura] Publishing Cobertura coverage report... [Cobertura] No coverage results were found using the pattern '**target/site/cobertura/coverage.xml' relative to '/home/pavan/.jenkins/workspace/gameoflife-deafult'. 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 Recording test results Finished: FAILURE

TG9541 commented 9 years ago

A hint for people struggling with JaCoCo path settings: mind the effect of unintended Markdown markup in wakaleo's post above ;-)

The following settings actually result in nice code coverage reports (trend, summary, and annotated source ):

Path to exec files: **/target/*.exec
Path to class directories: **/target
Path to source directories : **/src/main/java
Inclusions: **/*.class
Exclusions: **/When*
bedoyama commented 8 years ago

See: https://github.com/wakaleo/jenkins-the-definitive-guide-book/issues/15

For a solution. It boils down to

  1. add a format property to the build step to produce the coverage.xml cobertura:cobertura -Dcobertura.report.format=xml
  2. Deleting the line true

    in the surefire plugin to get a correct coverage report. (inside the pom file) Without this fix the report is 0% for everything.

alexqfredrickson commented 7 years ago

TG9541's suggestion works for me (nice catch!), and the build runs, but the JaCoCo code coverage results are all 0%:

INSTRUCTION 0%
BRANCH 0%
COMPLEXITY 0%
LINE 0%
METHOD 0%
CLASS 0%
bakalor commented 7 years ago

Thanks to everybody for clarifications, the JaCoCo works well.