0

I have a multimodule maven project and I can't find a way to disable pmd, checktyle for groovy sources.

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. Here is parent pom section inside pluginManagement:

 <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. Anyway pmd, check style is applied to the groovy sources.

module2 does have reference to these plugins in it's pom.xml And still groovy is not ignored.

What do I do wrong?

dmahapatro
  • 49,365
  • 7
  • 88
  • 117
Capacytron
  • 3,425
  • 6
  • 47
  • 80

1 Answers1

0

You can see all directories that have been processed by PMD-plugin if you run Maven with the debug option (-X). All directories are listed in the variable compileSourceRoots.

You can use those excludes for disabling PMD for groovy-stubs:

<excludeRoots>
    <excludeRoot>${project.build.directory}/generated-sources/groovy-stubs/main</excludeRoot>
    <excludeRoot>${project.build.directory}/generated-sources/groovy-stubs/test</excludeRoot>
</excludeRoots>
Sergey
  • 31
  • 2