Author: rfscholte Date: Wed Jun 24 20:26:26 2015 New Revision: 1687362 URL: http://svn.apache.org/r1687362 Log: [MCHECKSTYLE-295] Test resources are not included Contributed by Csaba Kozák , verified by Robert Scholte
Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/invoker.properties (with props) maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/pom.xml (with props) maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/MyClass.java (with props) maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/package-info.java (with props) maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/verify.groovy (with props) Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/pom.xml?rev=1687362&r1=1687361&r2=1687362&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/pom.xml Wed Jun 24 20:26:26 2015 @@ -75,6 +75,9 @@ under the License. <contributor> <name>Benson Margulies</name> </contributor> + <contributor> + <name>Csaba Kozák</name> + </contributor> </contributors> <dependencies> Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/invoker.properties?rev=1687362&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/invoker.properties (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/invoker.properties Wed Jun 24 20:26:26 2015 @@ -0,0 +1,19 @@ +# 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 +invoker.buildResult=failure Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/invoker.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/pom.xml?rev=1687362&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/pom.xml (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/pom.xml Wed Jun 24 20:26:26 2015 @@ -0,0 +1,69 @@ +<?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.its</groupId> + <artifactId>MCHECKSTYLE-295</artifactId> + <version>1.0-SNAPSHOT</version> + + <url>https://issues.apache.org/jira/browse/MCHECKSTYLE-295</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <checkstyle.violation.ignore>NewlineAtEndOfFile</checkstyle.violation.ignore> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <!-- some test resources are Java files and have to be properly formatted --> + <resourceIncludes>**\/*.java</resourceIncludes> + + <checkstyleRules> + <module name="Checker"> + <!-- Checks for Size Violations. --> + <!-- See http://checkstyle.sf.net/config_sizes.html --> + <module name="FileLength"> + <property name="max" value="10" /> + <property name="fileExtensions" value="java" /> + </module> + </module> + </checkstyleRules> + </configuration> + <executions> + <execution> + <id>check</id> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/MyClass.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/MyClass.java?rev=1687362&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/MyClass.java (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/MyClass.java Wed Jun 24 20:26:26 2015 @@ -0,0 +1,27 @@ +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. + */ + +/** + * My class. + */ +public class MyClass +{ +} Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/MyClass.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/package-info.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/package-info.java?rev=1687362&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/package-info.java (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/package-info.java Wed Jun 24 20:26:26 2015 @@ -0,0 +1,23 @@ +/** + * Nothing very important here, only a file for checkstyle rule PackageInfo. + */ +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. + */ Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/src/test/resources/package-info.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/verify.groovy?rev=1687362&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/verify.groovy (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/verify.groovy Wed Jun 24 20:26:26 2015 @@ -0,0 +1,22 @@ + +/* + * 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' ) + +assert buildLog.text.contains( "[INFO] There are 2 errors reported by Checkstyle" ) Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-295/verify.groovy ------------------------------------------------------------------------------ svn:eol-style = native 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=1687362&r1=1687361&r2=1687362&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 Wed Jun 24 20:26:26 2015 @@ -168,6 +168,14 @@ public class CheckstyleViolationCheckMoj */ @Parameter( defaultValue = "${project.resources}", readonly = true ) protected List<Resource> resources; + + /** + * Specifies the location of the test resources to be used for Checkstyle. + * + * @since 2.16 + */ + @Parameter( defaultValue = "${project.testResources}", readonly = true ) + protected List<Resource> testResources; /** * <p> @@ -520,7 +528,7 @@ public class CheckstyleViolationCheckMoj .setIncludeTestResources( includeTestResources ) .setIncludeTestSourceDirectory( includeTestSourceDirectory ).setListener( getListener() ) .setProject( project ).setSourceDirectories( getSourceDirectories() ) - .setResources( resources ) + .setResources( resources ).setTestResources( testResources ) .setStringOutputStream( stringOutputStream ).setSuppressionsLocation( suppressionsLocation ) .setTestSourceDirectories( getTestSourceDirectories() ).setConfigLocation( configLocation ) .setConfigurationArtifacts( collectArtifacts( "config" ) )