我是新手PMD/CPD
。我PMD
在我的maven项目中配置如下:
<groupId>org.parent</groupId>
<artifactId>CustRestExampleOsgi</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>CustRestExampleOsgii</name>
<modules>
<module>CustImplProvider</module>
<module>CustInterface</module>
<module>RestCustConsumer</module>
</modules>
<properties>
<karaf.deploy.build.folder>
G:\apache-karaf-3.0.0.RC1\deploy
</karaf.deploy.build.folder>
</properties>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
</plugin>
</plugins>
</reporting>
我的 maven 项目正在正常编译并生成所有报告mvn jxr:jxr site
。但我找不到任何显示重复代码的结果。为了测试这一点,我有意在我的代码中引入了重复代码,如下所示:
@Override
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 ((this.id == null && other.id != null)
|| (this.id != null && !this.id.equals(other.id))) {
return false;
}
if (!(object instanceof Address)) { //Duplicate is here
return false;
}
return true;
}
但始终CPD
显示在源代码中未检测到问题。但是我可以PMD
正常找到报告。我是否缺少一些配置或规则集?
请帮忙!