You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2013/11/10 22:04:53 UTC

svn commit: r1540550 - in /maven/plugins/trunk/maven-checkstyle-plugin/src: it/MCHECKSTYLE-193/ it/MCHECKSTYLE-193/src/ it/MCHECKSTYLE-193/src/main/ it/MCHECKSTYLE-193/src/main/resources/ main/java/org/apache/maven/plugin/checkstyle/

Author: bimargulies
Date: Sun Nov 10 21:04:52 2013
New Revision: 1540550

URL: http://svn.apache.org/r1540550
Log:
MCHECKSTYLE-193: add a complete set of control options for processing resources.

Added:
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/checkstyle.xml   (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/invoker.properties   (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/pom.xml   (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/test.properties   (with props)
Modified:
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleExecutorRequest.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/checkstyle.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/checkstyle.xml?rev=1540550&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/checkstyle.xml (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/checkstyle.xml Sun Nov 10 21:04:52 2013
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+<!-- 
+Checkstyle rules for Basis Technology.
+-->
+<module name="Checker">
+    <module name="TreeWalker">
+        <!-- Enable FileContentsHolder to allow us to in turn turn on suppression comments -->
+        <module name="FileContentsHolder"/>
+        <!-- Checks for Naming Conventions.                  -->
+        <!-- See http://checkstyle.sf.net/config_naming.html -->
+        <module name="ConstantName"/>
+        <module name="LocalFinalVariableName"/>
+        <module name="LocalVariableName"/>
+        <module name="MemberName"/>
+        <module name="MethodName"/>
+        <module name="PackageName"/>
+        <module name="ParameterName"/>
+        <module name="StaticVariableName"/>
+        <module name="TypeName"/>
+        <module name="IllegalImport"/>
+        <!-- defaults to sun.* packages -->
+        <module name="RedundantImport"/>
+        <module name="UnusedImports"/>
+        <!-- Checks for Size Violations.                    -->
+        <!-- See http://checkstyle.sf.net/config_sizes.html -->
+        <module name="AnonInnerLength">
+            <property name="max" value="40"/>
+        </module>
+        <module name="ExecutableStatementCount">
+            <property name="max" value="75"/>
+        </module>
+        <module name="MethodLength">
+            <property name="max" value="150"/>
+            <property name="countEmpty" value="false"/>
+        </module>
+        <module name="ParameterNumber">
+            <property name="max" value="20"/>
+        </module>
+        <!-- Checks for whitespace                               -->
+        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+        <module name="EmptyForIteratorPad"/>
+        <module name="EmptyForInitializerPad"/>
+        <module name="MethodParamPad"/>
+        <module name="NoWhitespaceAfter">
+            <property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
+        </module>
+        <module name="NoWhitespaceBefore"/>
+        <module name="OperatorWrap"/>
+        <module name="ParenPad"/>
+        <module name="TypecastParenPad"/>
+        <module name="WhitespaceAfter">
+            <property name="tokens" value="COMMA, SEMI"/>
+        </module>
+        <module name="WhitespaceAround">
+            <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND"/>
+        </module>
+        <!-- Modifier Checks                                    -->
+        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+        <module name="ModifierOrder"/>
+        <module name="RedundantModifier"/>
+        <!-- Checks for blocks. You know, those {}'s         -->
+        <!-- See http://checkstyle.sf.net/config_blocks.html -->
+        <module name="AvoidNestedBlocks">
+            <property name="allowInSwitchCase" value="true"/>
+        </module>
+        <module name="EmptyBlock">
+            <property name="option" value="text"/>
+        </module>
+        <module name="LeftCurly"/>
+        <module name="NeedBraces"/>
+        <module name="RightCurly"/>
+        <module name="CovariantEquals"/>
+<!-- blows up with eclipse-cs 5.6.0
+        <module name="DoubleCheckedLocking"/>
+-->
+	<module name="EmptyStatement"/>	      
+        <module name="EqualsHashCode"/>
+        <module name="HiddenField">
+	    <property name="tokens" value="VARIABLE_DEF"/>
+        </module>
+        <module name="IllegalInstantiation"/>
+        <module name="InnerAssignment"/>
+        <module name="MissingSwitchDefault"/>
+        <module name="SimplifyBooleanExpression"/>
+        <module name="SimplifyBooleanReturn"/>
+        <module name="StringLiteralEquality"/>
+        <module name="NestedIfDepth">
+            <property name="max" value="3"/>
+        </module>
+        <module name="NestedTryDepth">
+            <property name="max" value="3"/>
+        </module>
+        <module name="IllegalThrows">
+            <property name="illegalClassNames" value="java.lang.Error,java.lang.RuntimeException"/>
+        </module>
+        <module name="PackageDeclaration"/>
+        <module name="JUnitTestCase"/>
+        <module name="DeclarationOrder"/>
+        <module name="ExplicitInitialization"/>
+        <module name="DefaultComesLast"/>
+        <module name="FallThrough"/>
+        <module name="MultipleVariableDeclarations"/>
+        <module name="UnnecessaryParentheses"/>
+        <module name="FinalClass"/>
+        <module name="HideUtilityClassConstructor"/>
+        <module name="InterfaceIsType"/>
+        <module name="ThrowsCount">
+            <property name="max" value="5"/>
+        </module>
+        <module name="VisibilityModifier">
+            <property name="protectedAllowed" value="true"/>
+            <property name="packageAllowed" value="true"/>
+            <!-- Allow public members with 'Rule' on the end of their names to allow for 
+                 JUnit rules. Too bad we can't make this see the @nnotations.
+             -->
+            <property name="publicMemberPattern" value="^.*Rule$"/>
+        </module>
+        <!-- Metrics checks.                   -->
+        <!-- See http://checkstyle.sf.net/config_metrics.html -->
+        <module name="BooleanExpressionComplexity">
+            <property name="max" value="6"/>
+        </module>
+        <module name="JavaNCSS">
+            <property name="methodMaximum" value="75"/>
+        </module>
+        <module name="TodoComment">
+            <property name="format" value="WARNING"/>
+        </module>
+        <module name="UpperEll"/>
+        <!--Assert statement may have side effects:-->
+        <module name="DescendantToken">
+            <property name="tokens" value="LITERAL_ASSERT"/>
+            <property name="limitedTokens" value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN"/>
+            <property name="maximumNumber" value="0"/>
+        </module>
+        <module name="Indentation">
+            <property name="caseIndent" value="0"/>
+        </module>
+    </module>
+    <!-- Header checks -->
+    <module name="RegexpHeader">
+        <property name="header" value="/* A Required Header */"/>
+    </module>
+    <module name="SuppressionCommentFilter"/>
+    <module name="FileTabCharacter">
+      <property name="eachLine" value="true"/>
+    </module>
+</module>

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/checkstyle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/checkstyle.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/invoker.properties?rev=1540550&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/invoker.properties (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/invoker.properties Sun Nov 10 21:04:52 2013
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals=validate

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/invoker.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/pom.xml?rev=1540550&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/pom.xml (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/pom.xml Sun Nov 10 21:04:52 2013
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.checkstyle</groupId>
+  <artifactId>MCHECKSTYLE-193</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <url>http://maven.apache.org/</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+              <configLocation>checkstyle.xml</configLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+        </configuration>
+        <executions>
+          <execution>
+            <id>validate-1</id>
+            <phase>validate</phase>
+            <configuration>
+              <resourceExcludes>**/test.properties</resourceExcludes>
+            </configuration>
+            <goals>
+              <goal>checkstyle</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>validate-2</id>
+            <phase>validate</phase>
+            <configuration>
+              <includeResources>false</includeResources>
+            </configuration>
+            <goals>
+              <goal>checkstyle</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/test.properties?rev=1540550&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/test.properties (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/test.properties Sun Nov 10 21:04:52 2013
@@ -0,0 +1 @@
+someproperty=Some Property

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-193/src/main/resources/test.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java?rev=1540550&r1=1540549&r2=1540550&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java Sun Nov 10 21:04:52 2013
@@ -97,6 +97,14 @@ public abstract class AbstractCheckstyle
     protected List<Resource> resources;
 
     /**
+     * Specifies the location of the test resources to be used for Checkstyle.
+     *
+     * @since 2.11
+     */
+    @Parameter( defaultValue = "${project.testResources}", readonly = true )
+    protected List<Resource> testResources;
+
+    /**
      * If <code>null</code>, the Checkstyle plugin will display violations on stdout.
      * Otherwise, a text file will be created with the violations.
      */

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java?rev=1540550&r1=1540549&r2=1540550&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java Sun Nov 10 21:04:52 2013
@@ -57,6 +57,38 @@ public class CheckstyleAggregateReport
     private String excludes;
 
     /**
+     * Specifies the names filter of the resource files to be used for Checkstyle.
+     *
+     * <strong>Note:</strong> default value is {@code **\/*.properties}.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.resourceIncludes", defaultValue = "**/*.properties", required = true )
+    private String resourceIncludes;
+
+    /**
+     * Specifies the names filter of the resource files to be excluded for
+     * Checkstyle.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.resourceExcludes" )
+    private String resourceExcludes;
+
+    /**
+     * Specifies whether to include the resource directories in the check.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.includeResources", defaultValue = "true", required = true )
+    private boolean includeResources;
+
+    /**
+     * Specifies whether to include the test resource directories in the check.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.includeTestResources", defaultValue = "true", required = true )
+    private boolean includeTestResources;
+
+
+    /**
      * <p>
      * Specifies the location of the XML configuration to use.
      * </p>
@@ -248,13 +280,18 @@ public class CheckstyleAggregateReport
             throws MavenReportException
     {
         CheckstyleExecutorRequest request = new CheckstyleExecutorRequest();
-        request.setAggregate( true )
-            .setReactorProjects( reactorProjects )
-            .setConsoleListener( getConsoleListener() ).setConsoleOutput( consoleOutput )
-            .setExcludes( excludes ).setFailsOnError( failsOnError ).setIncludes( includes )
-            .setIncludeTestSourceDirectory( includeTestSourceDirectory ).setListener( getListener() )
+        request.setAggregate(true)
+            .setReactorProjects(reactorProjects)
+            .setConsoleListener(getConsoleListener()).setConsoleOutput(consoleOutput)
+            .setExcludes(excludes).setFailsOnError(failsOnError).setIncludes(includes)
+            .setIncludeResources( includeResources )
+            .setIncludeTestResources( includeTestResources )
+            .setResourceIncludes( resourceIncludes )
+            .setResourceExcludes( resourceExcludes )
+            .setIncludeTestSourceDirectory(includeTestSourceDirectory).setListener( getListener() )
             .setLog( getLog() ).setProject( project ).setSourceDirectory( sourceDirectory ).setResources( resources )
-            .setStringOutputStream( stringOutputStream ).setSuppressionsLocation( suppressionsLocation )
+            .setTestResources( testResources )
+            .setStringOutputStream(stringOutputStream).setSuppressionsLocation( suppressionsLocation )
             .setTestSourceDirectory( testSourceDirectory ).setConfigLocation( configLocation )
             .setPropertyExpansion( propertyExpansion ).setHeaderLocation( headerLocation )
             .setCacheFile( cacheFile ).setSuppressionsFileExpression( suppressionsFileExpression )

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleExecutorRequest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleExecutorRequest.java?rev=1540550&r1=1540549&r2=1540550&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleExecutorRequest.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleExecutorRequest.java Sun Nov 10 21:04:52 2013
@@ -48,6 +48,16 @@ public class CheckstyleExecutorRequest
      */
     private String excludes;
 
+    /**
+     * Specifies names filter for resources.
+     */
+    private String resourceIncludes;
+
+    /**
+     * Specifies names filter for resources.
+     */
+    private String resourceExcludes;
+
     private MavenProject project;
 
     private Log log;
@@ -60,8 +70,14 @@ public class CheckstyleExecutorRequest
 
     private File sourceDirectory;
 
+    private boolean includeResources;
+
+    private boolean includeTestResources;
+
     private List<Resource> resources;
 
+    private List<Resource> testResources;
+
     private boolean failsOnError;
 
     private AuditListener listener;
@@ -133,6 +149,28 @@ public class CheckstyleExecutorRequest
         return this;
     }
 
+    public String getResourceIncludes()
+    {
+        return resourceIncludes;
+    }
+
+    public CheckstyleExecutorRequest setResourceIncludes( String resourceIncludes )
+    {
+        this.resourceIncludes = resourceIncludes;
+        return this;
+    }
+
+    public String getResourceExcludes()
+    {
+        return resourceExcludes;
+    }
+
+    public CheckstyleExecutorRequest setResourceExcludes( String resourceExcludes )
+    {
+        this.resourceExcludes = resourceExcludes;
+        return this;
+    }
+
     public MavenProject getProject()
     {
         return project;
@@ -210,6 +248,17 @@ public class CheckstyleExecutorRequest
         return this;
     }
 
+    public List<Resource> getTestResources()
+    {
+        return testResources;
+    }
+
+    public CheckstyleExecutorRequest setTestResources( List<Resource> testResources )
+    {
+        this.testResources = testResources;
+        return this;
+    }
+
     public boolean isFailsOnError()
     {
         return failsOnError;
@@ -384,4 +433,34 @@ public class CheckstyleExecutorRequest
         this.reactorProjects = pReactorProjects;
         return this;
     }
+
+    public boolean isIncludeResources()
+    {
+        return includeResources;
+    }
+
+    /**
+     * @param includeResources whether to include the resource directories in the checks.
+     * @return This object.
+     */
+    public CheckstyleExecutorRequest setIncludeResources( boolean includeResources )
+    {
+        this.includeResources = includeResources;
+        return this;
+    }
+
+    public boolean isIncludeTestResources()
+    {
+        return includeTestResources;
+    }
+
+    /**
+     * @param includeTestResources whether to set the test resource directories in the checks.
+     * @return This object.
+     */
+    public CheckstyleExecutorRequest setIncludeTestResources( boolean includeTestResources )
+    {
+        this.includeTestResources = includeTestResources;
+        return this;
+    }
 }

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=1540550&r1=1540549&r2=1540550&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java Sun Nov 10 21:04:52 2013
@@ -78,6 +78,37 @@ public class CheckstyleReport
     private String excludes;
 
     /**
+     * Specifies the names filter of the source files to be used for Checkstyle.
+     * @since 2.11
+     *
+     * <strong>Note:</strong> default value is {@code **\/*.properties}.
+     */
+    @Parameter( property = "checkstyle.resourceIncludes", defaultValue = "**/*.properties", required = true )
+    private String resourceIncludes;
+
+    /**
+     * Specifies the names filter of the source files to be excluded for
+     * Checkstyle.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.resourceExcludes" )
+    private String resourceExcludes;
+
+    /**
+     * Specifies whether to include the resource directories in the check.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.includeResources", defaultValue = "true", required = true )
+    private boolean includeResources;
+
+    /**
+     * Specifies whether to include the test resource directories in the check.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.includeTestResources", defaultValue = "true", required = true )
+    private boolean includeTestResources;
+
+    /**
      * <p>
      * Specifies the location of the XML configuration to use.
      * </p>
@@ -348,6 +379,10 @@ public class CheckstyleReport
         CheckstyleExecutorRequest request = new CheckstyleExecutorRequest();
         request.setConsoleListener( getConsoleListener() ).setConsoleOutput( consoleOutput )
             .setExcludes( excludes ).setFailsOnError( failsOnError ).setIncludes( includes )
+            .setResourceIncludes( resourceIncludes )
+            .setResourceExcludes( resourceExcludes )
+            .setIncludeResources( includeResources )
+            .setIncludeTestResources( includeTestResources )
             .setIncludeTestSourceDirectory( includeTestSourceDirectory ).setListener( getListener() )
             .setLog( getLog() ).setProject( project ).setSourceDirectory( sourceDirectory ).setResources( resources )
             .setStringOutputStream( stringOutputStream ).setSuppressionsLocation( suppressionsLocation )

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java?rev=1540550&r1=1540549&r2=1540550&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Sun Nov 10 21:04:52 2013
@@ -315,6 +315,23 @@ public class CheckstyleViolationCheckMoj
     private String includes;
 
     /**
+     * Specifies the names filter of the files to be excluded for
+     * Checkstyle when checking resources.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.resourceExcludes" )
+    private String resourceExcludes;
+
+    /**
+     * Specifies the names filter of the files to be used for Checkstyle when checking resources.
+     *
+     * <strong>Note:</strong> default value is {@code **\/*.properties}.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.resourceIncludes", defaultValue = "**/*.properties", required = true )
+    private String resourceIncludes;
+
+    /**
      * Specifies if the build should fail upon a violation.
      */
     @Parameter( defaultValue = "false" )
@@ -343,8 +360,21 @@ public class CheckstyleViolationCheckMoj
     @Parameter( defaultValue = "${project.build.sourceDirectory}", required = true )
     private File sourceDirectory;
 
-    private ByteArrayOutputStream stringOutputStream;
+    /**
+     * Whether to apply CheckStyle to resource directories.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.includeResources", defaultValue = "true", required = true )
+    private boolean includeResources = true;
 
+    /**
+     * Whether to apply CheckStyle to test resource directories.
+     * @since 2.11
+     */
+    @Parameter( property = "checkstyle.includeTestResources", defaultValue = "true", required = true )
+    private boolean includeTestResources = true;
+
+    private ByteArrayOutputStream stringOutputStream;
 
     /** {@inheritDoc} */
     public void execute()
@@ -363,16 +393,19 @@ public class CheckstyleViolationCheckMoj
                 {
                     CheckstyleExecutorRequest request = new CheckstyleExecutorRequest();
                     request.setConsoleListener( getConsoleListener() ).setConsoleOutput( consoleOutput )
-                        .setExcludes( excludes ).setFailsOnError( failsOnError ).setIncludes( includes )
-                        .setIncludeTestSourceDirectory( includeTestSourceDirectory ).setListener( getListener() )
-                        .setLog( getLog() ).setProject( project ).setSourceDirectory( sourceDirectory ).setResources( resources )
-                        .setStringOutputStream( stringOutputStream ).setSuppressionsLocation( suppressionsLocation )
-                        .setTestSourceDirectory( testSourceDirectory ).setConfigLocation( configLocation )
-                        .setPropertyExpansion( propertyExpansion ).setHeaderLocation( headerLocation )
-                        .setCacheFile( cacheFile ).setSuppressionsFileExpression( suppressionsFileExpression )
-                        .setEncoding( encoding ).setPropertiesLocation( propertiesLocation );
-
-                    checkstyleExecutor.executeCheckstyle( request );
+                        .setExcludes(excludes).setFailsOnError(failsOnError).setIncludes(includes)
+                        .setResourceIncludes( resourceIncludes )
+                        .setResourceExcludes( resourceExcludes )
+                        .setIncludeResources( includeResources )
+                        .setIncludeTestResources( includeTestResources )
+                        .setIncludeTestSourceDirectory(includeTestSourceDirectory).setListener(getListener())
+                        .setLog(getLog()).setProject(project).setSourceDirectory(sourceDirectory).setResources(resources)
+                        .setStringOutputStream(stringOutputStream).setSuppressionsLocation(suppressionsLocation)
+                        .setTestSourceDirectory(testSourceDirectory).setConfigLocation(configLocation)
+                        .setPropertyExpansion(propertyExpansion).setHeaderLocation(headerLocation)
+                        .setCacheFile(cacheFile).setSuppressionsFileExpression(suppressionsFileExpression)
+                        .setEncoding(encoding).setPropertiesLocation(propertiesLocation);
+                    checkstyleExecutor.executeCheckstyle(request);
 
                 }
                 catch ( CheckstyleException e )

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java?rev=1540550&r1=1540549&r2=1540550&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/DefaultCheckstyleExecutor.java Sun Nov 10 21:04:52 2013
@@ -492,31 +492,32 @@ public class DefaultCheckstyleExecutor
         {
             for ( MavenProject project : request.getReactorProjects() )
             {
-                addFilesToProcess( request, excludesStr, new File( project.getBuild().getSourceDirectory() ),
-                                   project.getResources(), new File( project.getBuild().getTestSourceDirectory() ),
-                                   files );
+                addFilesToProcess( request, new File( project.getBuild().getSourceDirectory() ),
+                                   project.getResources(), project.getTestResources(),
+                                   files, new File( project.getBuild().getTestSourceDirectory() )
+                );
             }
         }
         else
         {
-            addFilesToProcess( request, excludesStr, sourceDirectory, request.getResources(),
-                               request.getTestSourceDirectory(), files );
+            addFilesToProcess( request, sourceDirectory, request.getResources(),
+                request.getTestResources(), files, request.getTestSourceDirectory() );
         }
 
         getLogger().debug( "Added " + files.size() + " files to process." );
 
-        return files.toArray(new File[files.size()]);
+        return files.toArray( new File[files.size()] );
     }
 
-    private void addFilesToProcess( CheckstyleExecutorRequest request, StringBuilder excludesStr, File sourceDirectory,
-                                    List<Resource> resources, File testSourceDirectory, List<File> files )
+    private void addFilesToProcess( CheckstyleExecutorRequest request, File sourceDirectory,
+                                   List<Resource> resources, List<Resource> testResources, List<File> files, File testSourceDirectory )
         throws IOException
     {
         if ( sourceDirectory != null && sourceDirectory.exists() )
         {
             final List sourceFiles = FileUtils.getFiles( sourceDirectory,
                                                          request.getIncludes(),
-                                                         excludesStr.toString() );
+                                                         request.getExcludes() );
             files.addAll( sourceFiles );
             getLogger().debug( "Added " + sourceFiles.size() + " source files found in '"
                     + sourceDirectory.getAbsolutePath() + "'." );
@@ -526,40 +527,52 @@ public class DefaultCheckstyleExecutor
             && ( testSourceDirectory.exists() ) && ( testSourceDirectory.isDirectory() ) )
         {
             final List testSourceFiles = FileUtils.getFiles( testSourceDirectory, request.getIncludes(),
-                                                             excludesStr.toString() );
+                                                             request.getExcludes() );
             files.addAll( testSourceFiles );
             getLogger().debug( "Added " + testSourceFiles.size() + " test source files found in '"
                     + testSourceDirectory.getAbsolutePath() + "'." );
         }
 
-        // @todo Should we add a check to see if resources should be included or not, similar to request.isIncludeTestSourceDirectory()?
-        if ( resources != null )
+        if ( resources != null && request.isIncludeResources() )
         {
-            for ( Resource resource : resources )
-            {
-                if ( resource.getDirectory() != null )
-                {
-                    File resourcesDirectory = new File( resource.getDirectory() );
-                    if ( resourcesDirectory.exists() && resourcesDirectory.isDirectory() )
-                    {
-                        // @todo Perhaps extend the functionality in the future so that the included types of files can be configured. For now it is hard-coded to properties files.
-                        List resourceFiles = FileUtils.getFiles( resourcesDirectory, "**/*.properties", null );
-                        files.addAll( resourceFiles );
-                        getLogger().debug( "Added " + resourceFiles.size() + " resource files found in '"
-                                + resourcesDirectory.getAbsolutePath() + "'." );
-                    }
-                    else
-                    {
-                        getLogger().debug( "The resources directory '" + resourcesDirectory.getAbsolutePath()
-                                + "' does not exist or is not a directory." );
-                    }
-                }
-            }
+            addResourceFilesToProcess( request, resources, files );
         }
         else
         {
             getLogger().debug( "No resources found in this project." );
         }
+
+        if ( testResources != null && request.isIncludeTestResources() )
+        {
+            addResourceFilesToProcess( request, testResources, files );
+        }
+        else
+        {
+            getLogger().debug( "No test resources found in this project." );
+        }
+    }
+
+    private void addResourceFilesToProcess( CheckstyleExecutorRequest request, List<Resource> resources, List<File> files ) throws IOException
+    {
+        for ( Resource resource : resources )
+        {
+            if ( resource.getDirectory() != null )
+            {
+                File resourcesDirectory = new File( resource.getDirectory() );
+                if ( resourcesDirectory.exists() && resourcesDirectory.isDirectory() )
+                {
+                    List resourceFiles = FileUtils.getFiles( resourcesDirectory, request.getResourceIncludes(), request.getResourceExcludes() );
+                    files.addAll( resourceFiles );
+                    getLogger().debug( "Added " + resourceFiles.size() + " resource files found in '"
+                            + resourcesDirectory.getAbsolutePath() + "'." );
+                }
+                else
+                {
+                    getLogger().debug( "The resources directory '" + resourcesDirectory.getAbsolutePath()
+                            + "' does not exist or is not a directory." );
+                }
+            }
+        }
     }
 
     private FilterSet getSuppressions( CheckstyleExecutorRequest request )