[英]How to get PMD maven plugin to skip generated source code?
所以我正在使用maven-plugin-plugin創建一個maven插件。 maven-plugin-plugin中的HelpMojo生成一個Java源文件。
不幸的是,PMD正在對此進行投訴。 有沒有一種方法可以讓PMD忽略單個源文件? 謝謝!
Maven PMD配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<executions>
<execution>
<id>pmd-verify</id>
<goals>
<goal>check</goal>
<goal>cpd-check</goal>
</goals>
<configuration>
<printFailingErrors>true</printFailingErrors>
</configuration>
</execution>
</executions>
</plugin>
生成的源通常以target/generated-sources
的子目錄結尾(使用maven),對於maven-plugin-plugin來說,它是target/generated-sources/plugin
。
您可以使用excludeRoots排除這些完整目錄,例如
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<executions>
<execution>
<id>pmd-verify</id>
<goals>
<goal>check</goal>
<goal>cpd-check</goal>
</goals>
<configuration>
<printFailingErrors>true</printFailingErrors>
<excludeRoots>
<excludeRoot>target/generated-sources/plugin</excludeRoot>
</excludeRoots>
</configuration>
</execution>
</executions>
</plugin>
還有一個基於文件的排除選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.