PMD/CPD can't detect duplicate code

I am new to PMD/CPD. I have configured PMD in my maven project as below:








My maven project is compiling normally and generating all reports by mvn jxr:jxr site. But I am unable to find any result which shows duplicate code. To test this I have introduced duplicate code intentionally in my code, as:

public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Address)) {
        return false;
    Address other = (Address) object;
    if (( == null && != null)
      || ( != null && ! {
        return false;
    if (!(object instanceof Address)) { //Duplicate is here
        return false;
    return true;

But always CPD shows no problem detected in the source code. However I can find PMD reports normally. Am I missing some configuration or ruleset?

Kindly help!


Make sure that you set the minimum token count low enough. Your short piece of duplicate code has fewer tokens than the default 100.

According to the docs, the property is called minimumTokens. Older versions of the Maven PMD plugin had a property maven.pmd.cpd.minimumtokencount. Set it to 5 for testing. In real life, the default of 100 is a good value.

Need Your Help

FLEX - Load remoteobject and shared them with modules

flex module remoteobject

I want to start out by saying that I am new to flex.

Jquery(ajax) PHP search results not displaying in search_results div under form

php jquery html ajax dom

For a website I'm making for school, I'm trying my hand at using Jquery extensively for the first time, and even though I managed quite a bit so far, I'm stuck at two (most likely related) problems...