Clone Digger integration with Hudson (by Pavol Zibrita)

Steps to integrate Clone Digger with Hudson:

  1. installing violations plugin
  2. installing clonedigger
  3. setup execution of clonedigger
  4. setup of violations plugin

Installing violations plugin

You can skip this, if you have already installed the violations plugin to the Hudson.

Install the Violations plugin. If you are not familiar with Hudson, refer to its manuals for installation. After having the Hudson installed and working, it should be easy to install the Violations plugin using the Hudson interface. Trobleshooting for Hudson is beyond the scope of this document.

Installing Clone Digger

Refer to download page of Clone Digger.

Setup execution of Clone Digger

When you get familiar with Hudson (or you already are), you know how to run tasks for a build. You have various option how to integrate the Clone Digger. As Clone Digger is a Python tool, you can integrate it already in yours superior build script for your project. Or, you can setup a Hudson schell script to execute. In this shell script, write something like:
#!/bin/bash
clonedigger --cpd-output -o clonedigger.xml [path to project]
echo "clonedigger complete"
The declaration of shell interpreter and echo should help to end the script not failing even if Clone Digger fails and so prevent the build from failing. There are already some great articles about how to use Hudson for Python projects:
Setting up a Python ci server with Hudson
Hudson embraces Python

Setup of violations plugin

The final step, should be to bind the clonedigger's output with the Hudson. So, using the violations plugin, put the '**/clonedigger.xml' string to the CPD field in the violations plugin setup. The clonedigger with --cpd-output will generate PMD's cpd similar output. (I hope there is no problem their XML schema in clonedigger).

That should be all. Now run the build and watch for yourself! Enjoy.