Detecting copy/pasted code is a useful technique to find potential buggy code. Duplicated code often results in bugs being fixed in only one version of the copied code. PMD is a great sourcecode analysis tool which integrates nicely with maven and has CPD (copy/paste detection) capabilities.
To configure with default settings and CPD support add the following to the pom:
[xml]
You can configure the minimum code size which trips the CPD. The default of 100 tokens corresponds to approximately 5-10 lines of code.
Generated reports look like this and show the file in which the duplicates where found and the duplicated code:
Really useful, great hooks for DRY-ing out code!