[英]Disable maven checkstyle, pmd for groovy sources in multimodule project
I have a multimodule maven project and I can't find a way to disable pmd, checktyle for groovy sources. 我有一个多模块的Maven项目,我找不到禁用groovy源的pmd,checktyle的方法。
I do run a command from the top level: 我确实从顶层运行命令:
mvn clean install pmd:pmd checktyle:checkstyle
The structure of my project is: 我的项目的结构是:
pom.xml
-module1
src
main
groovy
test
groovy
-module2
src
main
groovy
java
test
groovy
I don't want pmd/checkstyle to inspect my groovy files. 我不希望pmd / checkstyle检查我的常规文件。 Here is parent pom section inside pluginManagement : 这是pluginManagement内的parent pom部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.7.1</version>
<configuration>
<format>xml</format>
<targetJdk>1.6</targetJdk>
<linkXRef>false</linkXRef>
<!--
<excludeRoots>
<excludeRoot>${project.basedir}/src/main/groovy</excludeRoot>
<excludeRoot>${project.basedir}/src/test/groovy</excludeRoot>
</excludeRoots>
-->
<!--
<excludeRoots>
<excludeRoot>
${project.basedir}/target/generated-sources/groovy-stubs
</excludeRoot>
</excludeRoots>
-->
<excludes>
<exclude>**/generated-sources/groovy-stubs/**/*.java</exclude>
</excludes>
<rulesets>
<ruleset>
${rule.repository.url}/pmd/rules/pmd-rules/1.0.4.2/pmd-rules-1.0.4.2.xml
</ruleset>
</rulesets>
</configuration>
</plugin>
module1 doesn't have in it's pom.xml any references to pmd/checktyle plugin. module1在pom.xml中没有对pmd / checktyle插件的任何引用。 Anyway pmd, check style is applied to the groovy sources. 无论如何,将md校验样式应用于groovy源。
module2 does have reference to these plugins in it's pom.xml And still groovy is not ignored. module2确实在pom.xml中引用了这些插件,但仍然不能忽略groovy。
What do I do wrong? 我做错了什么?
You can see all directories that have been processed by PMD-plugin if you run Maven with the debug option (-X). 如果使用调试选项(-X)运行Maven,则可以查看PMD插件已处理的所有目录。 All directories are listed in the variable compileSourceRoots. 所有目录都列在变量compileSourceRoots中。
You can use those excludes for disabling PMD for groovy-stubs: 您可以使用那些排除项来禁用groovy-stub的PMD:
<excludeRoots>
<excludeRoot>${project.build.directory}/generated-sources/groovy-stubs/main</excludeRoot>
<excludeRoot>${project.build.directory}/generated-sources/groovy-stubs/test</excludeRoot>
</excludeRoots>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.