[MSHARED-407] Move maven_checks.xml and maven-header.txt to here from maven-checkstyle-plugin
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1654076 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index a22e5e9..93c9fc4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,4 +56,22 @@
<url>https://builds.apache.org/hudson/job/maven-shared/</url>
</ciManagement>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes combine.children="append">
+ <!--
+ This is a license header template.
+ -->
+ <exclude>src/main/resources/config/maven-header.txt</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
diff --git a/src/main/resources/config/maven-header.txt b/src/main/resources/config/maven-header.txt
new file mode 100644
index 0000000..5d3c3de
--- /dev/null
+++ b/src/main/resources/config/maven-header.txt
@@ -0,0 +1,21 @@
+^package
+^\s*$
+^/\*\s*$
+^ \* Licensed to the Apache Software Foundation \(ASF\) under one\s*$
+^ \* or more contributor license agreements. See the NOTICE file\s*$
+^ \* distributed with this work for additional information\s*$
+^ \* regarding copyright ownership. The ASF licenses this file\s*$
+^ \* to you under the Apache License, Version 2.0 \(the\s*$
+^ \* "License"\)\; you may not use this file except in compliance\s*$
+^ \* with the License. You may obtain a copy of the License at\s*$
+^ \*\s*$
+^ \*\s+http://www\.apache\.org/licenses/LICENSE-2\.0\s*$
+^ \*\s*$
+^ \* Unless required by applicable law or agreed to in writing,\s*$
+^ \* software distributed under the License is distributed on an\s*$
+^ \* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\s*$
+^ \* KIND, either express or implied. See the License for the\s*$
+^ \* specific language governing permissions and limitations\s*$
+^ \* under the License.\s*$
+^ \*/\s*$
+^\s*$
\ No newline at end of file
diff --git a/src/main/resources/config/maven_checks.xml b/src/main/resources/config/maven_checks.xml
new file mode 100644
index 0000000..fda20c4
--- /dev/null
+++ b/src/main/resources/config/maven_checks.xml
@@ -0,0 +1,221 @@
+<?xml version="1.0"?>
+<!--
+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.
+-->
+
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+ Checkstyle configuration that checks the Maven coding conventions from:
+ http://maven.apache.org/developers/conventions/code.html
+-->
+
+<module name="Checker">
+
+ <!-- Checks that each Java package has a Javadoc file used for commenting. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
+ <!--module name="JavadocPackage">
+ <property name="allowLegacy" value="true"/>
+ </module-->
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <!-- module name="NewlineAtEndOfFile"/ -->
+
+ <module name="FileLength"/>
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <module name="RegexpHeader">
+ <property name="fileExtensions" value="java"/>
+ <property name="headerFile" value="${checkstyle.header.file}"/>
+ </module>
+
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ </module>
+
+ <!-- Line with trailing spaces (disabled as it's too noisy) -->
+ <!--<module name="RegexpSingleline">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>-->
+
+ <module name="TreeWalker">
+
+ <property name="cacheFile" value="${checkstyle.cache.file}"/>
+
+ <property name="tabWidth" value="4"/>
+
+ <!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
+ <!-- see http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarningsHolder -->
+ <module name="SuppressWarningsHolder"/>
+
+ <!-- required for SuppressionCommentFilter -->
+ <!-- see http://checkstyle.sourceforge.net/config.html#SuppressionCommentFilter -->
+ <module name="FileContentsHolder"/>
+
+ <module name="LeftCurly">
+ <property name="option" value="nl"/>
+ </module>
+
+ <module name="RightCurly">
+ <property name="option" value="alone"/>
+ </module>
+
+ <module name="LineLength">
+ <property name="max" value="120" />
+ <property name="ignorePattern" value="@version|@see|@todo|TODO"/>
+ </module>
+
+ <module name="MemberName" />
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <module name="JavadocMethod">
+ <property name="severity" value="warning"/>
+ <property name="scope" value="protected"/>
+ </module>
+ <module name="JavadocType">
+ <property name="scope" value="protected"/>
+ <property name="allowUnknownTags" value="true" />
+ </module>
+ <module name="JavadocVariable">
+ <property name="severity" value="info"/>
+ <property name="scope" value="protected"/>
+ </module>
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="LocalFinalVariableName"/>
+ <module name="LocalVariableName"/>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="MethodLength"/>
+ <module name="ParameterNumber"/>
+
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad">
+ <property name="option" value="space"/>
+ </module>
+ <!-- module name="NoWhitespaceAfter"/ -->
+ <!-- module name="NoWhitespaceBefore"/ -->
+ <module name="OperatorWrap"/>
+ <module name="ParenPad">
+ <property name="option" value="space" />
+ </module>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+ <!-- module name="MethodParamPad"/ -->
+ <module name="GenericWhitespace"/>
+
+
+ <!-- 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"/>
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ </module>
+ <module name="NeedBraces"/>
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <!-- module name="AvoidInlineConditionals"/ -->
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField">
+ <property name="severity" value="warning"/>
+ <property name="ignoreSetter" value="true"/>
+ <property name="ignoreConstructorParameter" value="true"/>
+ </module>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ <module name="MagicNumber">
+ <!-- some numbers are really not that magic -->
+ <property name="ignoreNumbers" value="-4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 31, 32, 37, 64, 100, 128, 256, 512, 1000, 1024"/>
+ </module>
+ <module name="MissingSwitchDefault"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!-- module name="DesignForExtension"/ -->
+ <!-- module name="FinalClass"/ -->
+ <!-- module name="HideUtilityClassConstructor"/ -->
+ <module name="InterfaceIsType"/>
+ <module name="VisibilityModifier">
+ <property name="protectedAllowed" value="true"/>
+ <property name="packageAllowed" value="true"/>
+ </module>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!-- module name="ArrayTypeStyle"/ -->
+ <!-- module name="FinalParameters"/ -->
+ <!-- Let todo plugin handle this.
+ <module name="TodoComment"/>
+ -->
+ <module name="UpperEll"/>
+
+ </module>
+
+ <!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->
+ <!-- see http://checkstyle.sourceforge.net/config.html#SuppressWarningsFilter -->
+ <module name="SuppressWarningsFilter"/>
+
+ <!-- Checks properties file for a duplicated properties. -->
+ <!-- See http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties -->
+ <module name="UniqueProperties"/>
+
+ <!-- Support CHECKSTYLE_OFF: regexp and CHECKSTYLE_ON: regexp comments to disable/enable some checks -->
+ <!-- see http://checkstyle.sourceforge.net/config.html#SuppressionCommentFilter -->
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE_OFF\: (.+)"/>
+ <property name="onCommentFormat" value="CHECKSTYLE_ON\: (.+)"/>
+ <property name="checkFormat" value="$1"/>
+ </module>
+
+</module>
diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm
index 182b0df..8cbac0d 100644
--- a/src/site/apt/index.apt.vm
+++ b/src/site/apt/index.apt.vm
@@ -3,7 +3,7 @@
------
Dennis Lundberg
------
- 2013-07-24
+ 2015-01-22
------
~~ Licensed to the Apache Software Foundation (ASF) under one
@@ -35,14 +35,14 @@
* Maven Changes Plugin
-** org/apache/maven/plugins/announcement.vm
+** <<<org/apache/maven/plugins/announcement.vm>>>
This is a template that can be used by Maven Changes Plugin to create and send
an announcement e-mail for one of our plugins. It will create an announcement
e-mail that conforms to the "Promote the release" section of our
{{{http://maven.apache.org/developers/release/maven-project-release-procedure.html#Promote_the_release}release procedure}}.
-** org/apache/maven/shared/announcement.vm
+** <<<org/apache/maven/shared/announcement.vm>>>
This is a template that can be used by Maven Changes Plugin to create and send
an announcement e-mail for one of our shared components. It will create an
@@ -50,6 +50,20 @@
{{{http://maven.apache.org/developers/release/maven-project-release-procedure.html#Promote_the_release}release procedure}}.
+* Maven Checkstyle Plugin
+
+** <<<config/maven-header.txt>>>
+
+ This is a license header template that can be used by Maven Checkstyle Plugin
+ to verify that all files are using this license header.
+
+** {{{./maven_checks.html}<<<config/maven_checks.xml>>>}}
+
+ This is a Checkstyle configuration file for
+ {{{/developers/conventions/code.html}Maven coding conventions}} that can be
+ used in Maven Checkstyle Plugin.
+
+
* Usage
General instructions on how to use the Maven Shared Resources can be found on
diff --git a/src/site/apt/maven_checks.apt.vm b/src/site/apt/maven_checks.apt.vm
new file mode 100644
index 0000000..098a95e
--- /dev/null
+++ b/src/site/apt/maven_checks.apt.vm
@@ -0,0 +1,36 @@
+ ------
+ config/maven_checks.xml
+ ------
+ Hervé Boutemy
+ ------
+ 2015-01-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.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+
+<<<config/maven_checks.xml>>>
+
+ This is a predefined ruleset for
+ {{{/developers/conventions/code.html}Maven coding conventions}} that can be
+ used in Maven Checkstyle Plugin:
+
+%{snippet|file=${project.basedir}/src/main/resources/config/maven_checks.xml}
diff --git a/src/site/apt/usage.apt.vm b/src/site/apt/usage.apt.vm
index 9e29e9f..2812931 100644
--- a/src/site/apt/usage.apt.vm
+++ b/src/site/apt/usage.apt.vm
@@ -97,6 +97,34 @@
</project>
+----------+
+ or like this:
+
++----------+
+<project>
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.14</version>
+ <configuration>
+ <configLocation>config/maven_checks.xml</configLocation>
+ <headerLocation>config/maven-header.txt</headerLocation>
+ </configuration>
+ <dependencies>
+ ...
+ </dependencies>
+ <executions>
+ ...
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ ...
+</project>
++----------+
+
* Execute the plugin