Hudson build failing with NoClassDefFoundError when generating Cobertura coverage report

StackOverflow https://stackoverflow.com/questions/14949285

  •  10-03-2022
  •  | 
  •  

Domanda

I'm having a problem generating a Cobertura report with Hudson and Maven, and I'm hoping that someone here may have a solution.

I can see that cobertura artifacts are generated when hudson builds my project. But when I configure my hudson project to publish the Cobertura coverage report, I see that the build fails with the following error:

Publishing Cobertura coverage report ...
Publishing Cobertura coverage results ...
FATAL: org/jfree/chart/axis/CategoryAxis
java.lang.NoClassDefFoundError: org/jfree/chart/axis/CategoryAxis
  at hudson.plugins.cobertura.CoberturaXmlHandler.startDocument(...)

The build output shows that the Java version is 1.6.0_38

If I configure my project so that Cobertura coverage report is not generated, then the build succeeds.

The following plugins are installed on hudson:

  • Findbugs (version 4.41-h-2)
  • Checkstyle (version 3.28-h-1)
  • Cobertura (version 1-6-h-1)
  • Static Analysis Collector (version 1.28-h-1)
  • Static Analysis Utilities (version 1.42-h-1)
  • Maven 3 Build (version 3.0.0)

The following maven command is used:

  • clean install findbugs:findbugs checkstyle:checkstyle cobertura:cobertura

Any suggestions on how to fix this problem?

È stato utile?

Soluzione

You need to install the JFreeChart plugin as well, it's needed for generating charts in cobertura (that's why the class not found exception while running cobertura) but it has been removed from main hudson distribution:

(JFreeChart ...) Moved to an external plugin. Available from Alpha release. Any external plugins using JFreechart will need to add a dependency on this external plugin to maintain compatibility. For future charting needs BIRT Charts is now bundled as a core plugin

EDIT: there a bug in a transitive dependency as seen here. Install cobertura-plugin version 1.6-h-3. mvn

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top