You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2006/03/07 02:09:51 UTC
svn commit: r383734 -
/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
Author: carlos
Date: Mon Mar 6 17:09:50 2006
New Revision: 383734
URL: http://svn.apache.org/viewcvs?rev=383734&view=rev
Log:
[MPMD-16] Add option for exclusions
Submitted By: Joakim Erdfelt
Modified:
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java?rev=383734&r1=383733&r2=383734&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java Mon Mar 6 17:09:50 2006
@@ -134,6 +134,13 @@
private String sourceEncoding;
/**
+ * Files to exclude from checking. Can contain wildcards and double wildcards.
+ *
+ * @parameter
+ */
+ private String[] excludes;
+
+ /**
* @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale)
*/
public String getName( Locale locale )
@@ -204,9 +211,7 @@
List files;
try
{
- // MPMD-2 pmd has problems with package-info.java
- String excludes = "**/package-info.java";
- files = getFilesToProcess( "**/*.java", excludes );
+ files = getFilesToProcess( "**/*.java", getExclusionsString( excludes ) );
}
catch ( IOException e )
{
@@ -369,7 +374,7 @@
}
excludesStr.append( defaultExcludes[i] );
}
-
+ getLog().debug( "Excluded files: '" + excludesStr + "'" );
return FileUtils.getFiles( dir, includes, excludesStr.toString() );
}
@@ -426,5 +431,27 @@
}
throw new MavenReportException( "Can't create report with format of " + format );
+ }
+
+ private String getExclusionsString( String[] exclude )
+ {
+ StringBuffer excludes = new StringBuffer();
+
+
+ if ( exclude == null )
+ {
+ return excludes.toString();
+ }
+
+ for ( int index = 0; index < exclude.length; index++ )
+ {
+ if ( excludes.length() > 0 )
+ {
+ excludes.append( ',' );
+ }
+ excludes.append( exclude[index] );
+ }
+
+ return excludes.toString();
}
}