Author: gboue
Date: Sat Jan 28 00:50:38 2017
New Revision: 1780622

URL: http://svn.apache.org/viewvc?rev=1780622&view=rev
Log:
[MCHECKSTYLE-260] sourceDirectories property is ignored in multi-modules

Because of a bug in Sisu, plugin parameters of type Collection or array are 
always using their default value if it is specified (MNG-5440). This was fixed 
in 3.3.9, but to be able to have compatibility for all Maven 3.x versions, we 
have to handle the default value manually, instead of relying on @Parameter's 
defaultValue mechanism.

Updating the MavenProject stub tests so that they return meaningful values for 
compileSourceRoot and testCompileSourceRoot (thus getting rid of the specific 
code inside the actual Mojo checking for null when that cannot happen on a real 
project).

Added:
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/pom.xml
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/MyClass.java
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/pom.xml
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/MyClass.java
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/invoker.properties
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/pom.xml
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/verify.groovy
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/pom.xml
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/MyClass.java
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/pom.xml
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/MyClass.java
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/invoker.properties
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/pom.xml
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/verify.groovy
   (with props)
Modified:
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
    
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java
    
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java
    
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/pom.xml?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/pom.xml
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,56 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.plugins.checkstyle.its</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-a</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>main-source</id>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>src/generated/java</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/MyClass.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/MyClass.java?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/MyClass.java
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/MyClass.java
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,24 @@
+package org;
+
+/*
+ * 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.
+ */
+
+public class MyClass
+{
+}

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-a/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/pom.xml?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/pom.xml
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,56 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.plugins.checkstyle.its</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-b</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>main-source</id>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>src/generated/java</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/MyClass.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/MyClass.java?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/MyClass.java
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/MyClass.java
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,24 @@
+package org;
+
+/*
+ * 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.
+ */
+
+public class MyClass
+{
+}

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/child-b/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/invoker.properties?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/invoker.properties
 Sat Jan 28 00:50:38 2017
@@ -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=verify

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/pom.xml?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/pom.xml
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,58 @@
+<?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/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.checkstyle.its</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <url>https://issues.apache.org/jira/browse/MCHECKSTYLE-260</url>
+  <description>Tests that sourceDirectory in honored in multi-module 
projects.</description>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <modules>
+    <module>child-a</module>
+    <module>child-b</module>
+  </modules>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+          <sourceDirectories>
+            <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+          </sourceDirectories>
+        </configuration>
+        <executions>
+          <execution>
+            <id>check</id>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/verify.groovy?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/verify.groovy
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/verify.groovy
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,24 @@
+
+/*
+ * 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.
+ */
+def buildLog = new File( basedir, 'build.log' )
+
+// 3 errors would be in child-a/src/generated/java and 
child-b/src/generated/java
+// but both locations shouldn't be checked
+assert !buildLog.text.contains( "[INFO] There are 3 errors reported by 
Checkstyle" )

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-sourceDirectories/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/pom.xml?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/pom.xml
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,56 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.plugins.checkstyle.its</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-a</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>test-source</id>
+            <goals>
+              <goal>add-test-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>src/generated/java</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/MyClass.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/MyClass.java?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/MyClass.java
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/MyClass.java
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,24 @@
+package org;
+
+/*
+ * 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.
+ */
+
+public class MyClass
+{
+}

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-a/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/pom.xml?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/pom.xml
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,56 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.plugins.checkstyle.its</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-b</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>test-source</id>
+            <goals>
+              <goal>add-test-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>src/generated/java</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/MyClass.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/MyClass.java?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/MyClass.java
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/MyClass.java
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,24 @@
+package org;
+
+/*
+ * 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.
+ */
+
+public class MyClass
+{
+}

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/child-b/src/generated/java/org/MyClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/invoker.properties?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/invoker.properties
 Sat Jan 28 00:50:38 2017
@@ -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=verify

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/pom.xml?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/pom.xml
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,58 @@
+<?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/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.checkstyle.its</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <url>https://issues.apache.org/jira/browse/MCHECKSTYLE-260</url>
+  <description>Tests that testSourceDirectory in honored in multi-module 
projects.</description>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <modules>
+    <module>child-a</module>
+    <module>child-b</module>
+  </modules>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+          <testSourceDirectories>
+            
<testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
+          </testSourceDirectories>
+        </configuration>
+        <executions>
+          <execution>
+            <id>check</id>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

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

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/verify.groovy?rev=1780622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/verify.groovy
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/verify.groovy
 Sat Jan 28 00:50:38 2017
@@ -0,0 +1,24 @@
+
+/*
+ * 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.
+ */
+def buildLog = new File( basedir, 'build.log' )
+
+// 3 errors would be in child-a/src/generated/java and 
child-b/src/generated/java
+// but both locations shouldn't be checked
+assert !buildLog.text.contains( "[INFO] There are 3 errors reported by 
Checkstyle" )

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-260-testSourceDirectories/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java?rev=1780622&r1=1780621&r2=1780622&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
 Sat Jan 28 00:50:38 2017
@@ -274,9 +274,11 @@ public abstract class AbstractCheckstyle
 
     /**
      * Specifies the location of the source directories to be used for 
Checkstyle.
+     * Default value is <code>${project.compileSourceRoots}</code>.
      * @since 2.13
      */
-    @Parameter( defaultValue = "${project.compileSourceRoots}" )
+    // Compatibility with all Maven 3: default of 'project.compileSourceRoots' 
is done manually because of MNG-5440
+    @Parameter
     private List<String> sourceDirectories;
     
     /**
@@ -292,9 +294,11 @@ public abstract class AbstractCheckstyle
     
     /**
      * Specifies the location of the test source directories to be used for 
Checkstyle.
+     * Default value is <code>${project.testCompileSourceRoots}</code>.
      * @since 2.13
      */
-    @Parameter( defaultValue = "${project.testCompileSourceRoots}" )
+    // Compatibility with all Maven 3: default of 
'project.testCompileSourceRoots' is done manually because of MNG-5440
+    @Parameter
     private List<String> testSourceDirectories;
 
     /**
@@ -719,6 +723,10 @@ public abstract class AbstractCheckstyle
         }
         else
         {
+            if ( sourceDirectories == null )
+            {
+                sourceDirectories = project.getCompileSourceRoots();
+            }
             sourceDirs = new ArrayList<>( sourceDirectories.size() );
             for ( String sourceDir : sourceDirectories )
             {
@@ -737,9 +745,12 @@ public abstract class AbstractCheckstyle
         {
             testSourceDirs = Collections.singletonList( testSourceDirectory );
         }
-        // probably null-check only required due to MavenProjectStubs
-        else if ( testSourceDirectories != null )
+        else
         {
+            if ( testSourceDirectories == null )
+            {
+                testSourceDirectories = project.getTestCompileSourceRoots();
+            }
             testSourceDirs = new ArrayList<>( testSourceDirectories.size() );
             for ( String testSourceDir : testSourceDirectories )
             {

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java?rev=1780622&r1=1780621&r2=1780622&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
 Sat Jan 28 00:50:38 2017
@@ -392,11 +392,12 @@ public class CheckstyleViolationCheckMoj
     private File testSourceDirectory;
 
     /**
-     * Specifies the location of the test source directories to be used for
-     * Checkstyle.
+     * Specifies the location of the test source directories to be used for 
Checkstyle.
+     * Default value is <code>${project.testCompileSourceRoots}</code>.
      * @since 2.13
      */
-    @Parameter( defaultValue = "${project.testCompileSourceRoots}" )
+    // Compatibility with all Maven 3: default of 
'project.testCompileSourceRoots' is done manually because of MNG-5440
+    @Parameter
     private List<String> testSourceDirectories;
 
     /**
@@ -418,9 +419,11 @@ public class CheckstyleViolationCheckMoj
 
     /**
      * Specifies the location of the source directories to be used for 
Checkstyle.
+     * Default value is <code>${project.compileSourceRoots}</code>.
      * @since 2.13
      */
-    @Parameter( defaultValue = "${project.compileSourceRoots}" )
+    // Compatibility with all Maven 3: default of 'project.compileSourceRoots' 
is done manually because of MNG-5440
+    @Parameter
     private List<String> sourceDirectories;
 
     /**
@@ -827,6 +830,10 @@ public class CheckstyleViolationCheckMoj
         }
         else
         {
+            if ( sourceDirectories == null )
+            {
+                sourceDirectories = project.getCompileSourceRoots();
+            }
             sourceDirs = new ArrayList<>( sourceDirectories.size() );
             for ( String sourceDir : sourceDirectories )
             {
@@ -845,9 +852,12 @@ public class CheckstyleViolationCheckMoj
         {
             testSourceDirs = Collections.singletonList( testSourceDirectory );
         }
-        // probably null-check only required due to MavenProjectStubs
-        else if ( testSourceDirectories != null )
+        else
         {
+            if ( testSourceDirectories == null )
+            {
+                testSourceDirectories = project.getTestCompileSourceRoots();
+            }
             testSourceDirs = new ArrayList<>( testSourceDirectories.size() );
             for ( String testSourceDir : testSourceDirectories )
             {

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java?rev=1780622&r1=1780621&r2=1780622&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java
 Sat Jan 28 00:50:38 2017
@@ -41,7 +41,7 @@ public class MinMavenProjectStub
     public List<String> getCompileClasspathElements()
         throws DependencyResolutionRequiredException
     {
-        return Collections.singletonList( PlexusTestCase.getBasedir() + 
"/target/classes" );
+        return getCompileSourceRoots();
     }
 
     /** {@inheritDoc} */
@@ -52,6 +52,20 @@ public class MinMavenProjectStub
         list.add( PlexusTestCase.getBasedir() + "/target/test-classes" );
         return list;
     }
+
+    /** {@inheritDoc} */
+    public List<String> getCompileSourceRoots()
+    {
+        return Collections.singletonList( PlexusTestCase.getBasedir() + 
"/target/classes" );
+    }
+
+    /** {@inheritDoc} */
+    public List<String> getTestCompileSourceRoots()
+    {
+        List<String> list = new ArrayList<>( getCompileSourceRoots() );
+        list.add( PlexusTestCase.getBasedir() + "/target/test-classes" );
+        return list;
+    }
 
     /** {@inheritDoc} */
     public File getBasedir()

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java?rev=1780622&r1=1780621&r2=1780622&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java
 Sat Jan 28 00:50:38 2017
@@ -42,7 +42,7 @@ public class ModuleMavenProjectStub
     public List<String> getCompileClasspathElements()
         throws DependencyResolutionRequiredException
     {
-        return Collections.singletonList( PlexusTestCase.getBasedir() + 
"/target/classes" );
+        return getCompileSourceRoots();
     }
 
     /** {@inheritDoc} */
@@ -53,6 +53,20 @@ public class ModuleMavenProjectStub
         list.add( PlexusTestCase.getBasedir() + "/target/test-classes" );
         return list;
     }
+
+    /** {@inheritDoc} */
+    public List<String> getCompileSourceRoots()
+    {
+        return Collections.singletonList( PlexusTestCase.getBasedir() + 
"/target/classes" );
+    }
+
+    /** {@inheritDoc} */
+    public List<String> getTestCompileSourceRoots()
+    {
+        List<String> list = new ArrayList<>( getCompileSourceRoots() );
+        list.add( PlexusTestCase.getBasedir() + "/target/test-classes" );
+        return list;
+    }
 
     /** {@inheritDoc} */
     public File getBasedir()

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java?rev=1780622&r1=1780621&r2=1780622&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java
 Sat Jan 28 00:50:38 2017
@@ -63,6 +63,18 @@ public class MultiMavenProjectStub
     }
 
     /** {@inheritDoc} */
+    public List<String> getCompileSourceRoots()
+    {
+        return Collections.emptyList();
+    }
+
+    /** {@inheritDoc} */
+    public List<String> getTestCompileSourceRoots()
+    {
+        return Collections.emptyList();
+    }
+
+    /** {@inheritDoc} */
     public File getBasedir()
     {
         return new File( PlexusTestCase.getBasedir() );


Reply via email to