就像 khmarbaise 所说,以下配置有效:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${plugin.maven.pmd.version}</version>
<configuration>
<minimumTokens>100</minimumTokens>
<targetJdk>${jdk.version}</targetJdk>
<printFailingErrors>true</printFailingErrors>
<rulesets>
<ruleset>example_pmd.xml</ruleset>
</rulesets>
</configuration>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>${example.version}</version>
</dependency>
</dependencies>
</plugin>