Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage report not there #14

Open
tfm64 opened this issue Dec 19, 2012 · 16 comments
Open

Coverage report not there #14

tfm64 opened this issue Dec 19, 2012 · 16 comments

Comments

@tfm64
Copy link

tfm64 commented Dec 19, 2012

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
Copy link

dduck commented Dec 27, 2012

I am having the same issue. Any ideas?

@EivindEE
Copy link

EivindEE commented Feb 7, 2013

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
Copy link

rachelo commented Feb 21, 2013

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
Copy link

I have the same problem too..Any solutions?

@wakaleo
Copy link
Owner

wakaleo commented Mar 13, 2013

The warning shouldn't stop the build working correctly.

On 13 March 2013 20:30, technorat [email protected] wrote:

I have the same problem too..Any solutions?


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


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | [email protected]

@faonur
Copy link

faonur commented Oct 30, 2013

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
Copy link

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
Copy link
Owner

wakaleo commented Nov 19, 2013

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
Copy link

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
Copy link

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

Otherwise JaCoCo complains about "Expecting Ant GLOB pattern"

@striker88
Copy link

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
Copy link

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
Copy link

TG9541 commented Nov 2, 2014

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
Copy link

See:
wakaleo/jenkins-the-definitive-guide-book#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.

bozoh added a commit to bozoh/game-of-life that referenced this issue Mar 21, 2017
@alexqfredrickson
Copy link

alexqfredrickson commented Jun 14, 2017

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
Copy link

bakalor commented Aug 14, 2017

Thanks to everybody for clarifications, the JaCoCo works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests