Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Plugin Information

View Crap4J on the plugin site for more information.

This plugin reads the "crappy methods" report from Crap4J. Jenkins will generate the trend report of crap percentage and provide detailed information about changes. Users will be able to track which methods are crappy and when they entered and left the code base.


Currently, this plugin is restricted to use with freestyle (ant) jobs. Future releases might support all kinds of jobs. Let me know your needs by filing a request for enhancement in the issue tracker.


The crap4j plugin scans the Crap4J report data and reports trends.
These features are currently implemented:

  • Crap report page for jobs
    • Trend charts for Crappyness, Crap Method Count, Crap Load and Crap
    • List of all current crap methods of the job
  • Crappyness trend chart on job overview page
  • Crap report page for builds
    • List of all current crap methods of the build
    • List of new and fixed crap methods in comparison to the previous build
  • Crap report summary in the build report column
    • Statistical summary and links to current, new and fixed crap methods

Configuring the Crap4J Plugin

  1. Get the crap4j plugin, preferably using Jenkins plugin manager
  2. Install the crap4j plugin in your Jenkins, if downloaded manually
  3. Configure your project's build script to generate crap4j XML reports (This happens along with the HTML report)
  4. Enable the "Publish Crap" publisher on the job configuration page
  5. Specify the directory where the crap4j report (report.xml) is generated
  6. Perform some builds to receive a trend

The crap4j plugin currently has no configurable parameters. The build health indicator is set to the Crap4J quality suggestion, with 15% crappy methods being 0% build health.


This plugin is developed and maintained by Daniel Lindner with kind support from Softwareschneiderei GmbH. Please feel free to contact me for feedback. If you have suggestions for new features or you've found a bug, please use the issue tracker or the mailing lists. If you use the issue tracker, assign the issue directly to java.net ID dlindner.


Release 0.9 (2014-10-22):

  • Fail-fast behaviour by explicitly signaling missing report files (see Issue 24912)
  • Uses Jenkins URL instead of server name now (see Issue 22279)

Release 0.8 (2010-08-01):

  • Fix incompatibility with hudson core version 1.368 (see Issue 7088)
  • Job configuration is stored again (see Issue 5493)
    • Attention! This requires you to re-configure all your crap4j-enabled jobs once. Sorry for the inconvenience!

Release 0.7 (2009-12-30):

  • Fix links for installs with context path (see Issue 4361)
  • Decrease parsing effort of not crappy methods
  • Remove dependency on maven plugin
  • Update code for more recent Hudson

Release 0.6.1 (2009-03-15):

  • Restored compatibility with Java 5 (see Issue 3282, reported by felixdrueke)

Release 0.6 (2009-02-25):

  • Several report.xml files can be merged into one report now (see Issue 2995, suggested by Oliver Imlinger)
  • Report parsing takes locale into account (see Issue 2953, reported by Oliver Imlinger)
  • Report path pattern now supports space characters (see Issue 2963, reported by Mihael Vrbanec)
    • Attention! This breaks backward compatibility for patterns using spaces as separators. Use commas instead.

Release 0.5 (2008-12-31):

  • Enabled use in Master/Slave setups (see Issue 2385)

Release 0.4 (2008-07-03):

  • Identical on features to version 0.3
  • Added missing documentation
  • Corrected misleading configuration section title

Release 0.3 (2008-07-03) - please use 0.4 instead.

  • Bugfix: crappyness trend chart missing scale on y-axis if lower than 1.0 (Issue 1952, reported by Nigel Charman)
  • Enhancement: Adjustable build health indicator (Issue 1985)

Release 0.2 (2008-06-03):

  • Compatible to Java5 VMs. Improvement request by Leon Oosterwijk.

Release 0.1 (2008-05-17):

  • Initial release. Please feel free to suggest new features.


  1. Unknown User (shadowspires)

    Any chance of getting this plugin to actually retain the crap4j reports that the tool produces for each build?  I like the trend charts, but the html views produced by crap4j give better details about the methods and why they are considered "crappy". 

    1. Unknown User (dlindner)

      Hi Travis. Sorry for the late reply. What is the information you miss for this plugin in comparison to the original crap4j report? You can have a list of crappy methods (and their statistics) for each build by clicking on the crap4j icon or following an URL like this one: http://<hudson-host>/job/<job-name>/crap/

      Would you mind filing an enhancement issue with your wishes? I will definitly consider it once i understand your point.

  2. Unknown User (nigel.charman)

    I came across some problems running the crap4j ant tasks with Windows.  The workaround, including how to get the crap4j ant tasks to run in Hudson, is described in my post Crap4J, Hudson and Windows.

    +1 for getting the plugin to retain the crap4j reports, or at least show the complexity, coverage and crap for all methods (not just those above the threshold).

    I'm also keen to be able to be able to adjust the threshold. 

    1. Unknown User (dlindner)

      I turned your suggestions into issues:

      We should continue the discussion about these issues there.

  3. Unknown User (trinition)

    I'm using Hudson for my .NET builds.  I've used Crap4N to produce an XML file with hopes of this consuming it.  However, the ReportReader is blowing up with "java.io.IOException: Error on line 1: Content is not allowed in prolog."  This is generally a sign of an improperly formatted XML with some content before the XML prolog.  There doesn't appear to be anything wrong with the XML at first glance, but if you open it in a hex editor, you can see that there's a UTF-16 BOM character (which is invisible) at the front of the file.  Is there anything that can be done in your XML reading/parsing code to honor UTF BOM characters?

    1. Unknown User (trinition)

      FWIW, This is a "bug" at Oracle (previously Sun): http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058; however, they refuse to fix.  However, there are ways (e.g. http://stackoverflow.com/questions/1835430/byte-order-mark-screws-up-file-reading-in-java) to guard against BOMs when reading XML files in Java.