有人可以告诉我如何使用 maven 从 PMD 分析中排除某些接口。在进行 Maven 构建时,我遇到了以下异常。
PMD 失败:ILogin$RetrieveLoginInfo_:4 Rule:ConstantsInInterface Priority:3 避免接口中的常量。接口定义类型,常量是更好地放置在类或枚举中的实现细节。参见有效的 Java,第 19 项.. [
我在 pom 的属性中添加了 exclude-pmd.properties。这是我在 pom.xml 属性中的条目。
<pmd.excludeFromFailureFile>${project.basedir}/src/etc/exclude-pmd.properties</pmd.excludeFromFailureFile>
排除-pmd.properties 条目:
com.login.ILogin=ConstantsInInterface Priority:3 Avoid constants in interfaces.
界面:
public interface ILogin {
interface RetrieveLoginInfo_ {
int STATUS=0
}
}
但是 maven 并没有从 PMD 分析中排除 ILogin 接口。