Give PMD include/exclude filters. Same idea as in Checkstyle.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113685 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh 2003-07-22 16:13:27 +00:00
parent 1bb179001d
commit be7204e145
5 changed files with 44 additions and 4 deletions

View File

@ -82,7 +82,9 @@
<pmd rulesetfiles="${maven.pmd.rulesetfiles}"> <pmd rulesetfiles="${maven.pmd.rulesetfiles}">
<formatter type="xml" toFile="${maven.build.dir}/pmd-raw-report.xml"/> <formatter type="xml" toFile="${maven.build.dir}/pmd-raw-report.xml"/>
<fileset dir="${pom.build.sourceDirectory}"> <fileset dir="${pom.build.sourceDirectory}">
<include name="**/*.java"/> <include name="${maven.pmd.includes}"/>
<exclude name="${maven.pmd.excludes}"/>
<!-- FIXME: This is a bad cut and paste --> <!-- FIXME: This is a bad cut and paste -->
<!-- handle source modifications --> <!-- handle source modifications -->
<j:forEach var="sm" items="${pom.build.sourceModifications}"> <j:forEach var="sm" items="${pom.build.sourceModifications}">
@ -99,7 +101,7 @@
</fileset> </fileset>
</pmd> </pmd>
<!-- Run DVSL to transform the report into XDOC --> <!-- Run JSL to transform the report into XDOC -->
<echo>Converting the PMD report to xdoc ...</echo> <echo>Converting the PMD report to xdoc ...</echo>

View File

@ -12,3 +12,6 @@ maven.pmd.enable = true
# rulesets/experimental.xml is, well, experimental ... use at your own risk # rulesets/experimental.xml is, well, experimental ... use at your own risk
maven.pmd.rulesetfiles=${plugin.resources}/rulesets/basic.xml,${plugin.resources}/rulesets/unusedcode.xml,${plugin.resources}/rulesets/imports.xml maven.pmd.rulesetfiles=${plugin.resources}/rulesets/basic.xml,${plugin.resources}/rulesets/unusedcode.xml,${plugin.resources}/rulesets/imports.xml
maven.pmd.includes = **/*.java
maven.pmd.excludes =

View File

@ -9,6 +9,9 @@
<body> <body>
<release version="1.1" date="in CVS"> <release version="1.1" date="in CVS">
<action dev="epugh" type="add">
Adding maven.pmd.includes and maven.pmd.excludes to match functionality in checkstyle plugin.
</action>
<action dev="dion" type="fix"> <action dev="dion" type="fix">
Now respects pom.build.sourceModifications Now respects pom.build.sourceModifications
</action> </action>

View File

@ -21,12 +21,20 @@
</p> </p>
</subsection> </subsection>
<subsection name="How to disable PMD for one projects?"> <subsection name="How to disable PMD for one project?">
<p> <p>
Assume that you have generated a DB layer having a few Assume that you have generated a DB layer having a few
hundreds Java source files. Apart from being curious you hundreds Java source files. Apart from being curious you
don't want to have a PMD report for generated source files. don't want to have a PMD report for generated source files.
Simple put "maven.pmd.enable=false" into your project properties Simply put "maven.pmd.enable=false" into your project properties.
</p>
</subsection>
<subsection name="How to disable PMD for certain files?">
<p>
Also assuming that you have generated a DB layer within your project.
Simply put "maven.pmd.excludes=**/database/**" into your project
properties.
</p> </p>
</subsection> </subsection>

View File

@ -30,6 +30,30 @@
already defined in the plugin already defined in the plugin
</td> </td>
</tr> </tr>
<tr>
<td>maven.pmd.includes</td>
<td>Yes</td>
<td>
Specifies a comma-separated list of Ant patterns to use
when matching files in the source tree to be included in the
PMD report. The pattern specified is relative to
<code>${maven.src.dir}</code>. The default value is
<code>**/*.java</code>, which matches all Java source files
in the source tree (specified by the <code>${maven.src.dir}</code>
property.
</td>
</tr>
<tr>
<td>maven.pmd.excludes</td>
<td>Yes</td>
<td>
Specifies a comma-separated list of Ant patterns to use when
matching files in the source tree to be excluded from the
PMD report. The pattern specified is relative to
<code>${maven.src.dir}</code>. The default value is to not
exclude any files.
</td>
</tr>
</table> </table>
</section> </section>
</body> </body>