CheckStyle

HomePage | RecentChanges | Preferences

To use a regexp header with CheckStyle and Maven 2...

Take the LICENSE.CheckStyle file, replace all newlines with \n to make a really long string, then use that as the 'header' property's value:

I couldn't get the quotes around "AS IS" and "LICENSE" to work, so I just used '.' (any character).

Having done this... I don't think we're going to have to use headers for much longer, so just stick it here in case we need it.

Index: shale_checks.xml
===================================================================
--- shale_checks.xml    (revision 418916)
+++ shale_checks.xml    (working copy)
@@ -134,11 +134,11 @@

         <!-- Following interprets the header file as regular expressions. -->
         <!-- <module name="RegexpHeader"/>                                -->
-        <!--module name="RegexpHeader">
-            <property name="headerFile" value="${checkstyle.regexp.header}"/>
-        </module-->
+        <module name="RegexpHeader">
+            <property name="header"
+                      value="/\*\s*\n \*\s*\$Id.*\$\n \*\s*\n \*\s*Copyright \d
{4}(-\d{4}|,\d{4})* The Apache Software Foundation\.\n \*\s*\n \*\s*Licensed und
er the Apache License, Version 2\.0 \(the .License.\);\n \*\s*you may not use th
is file except in compliance with the License\.\n \*\s*You may obtain a copy of
the License at\n \*\s*\n \*\s*http://www\.apache\.org/licenses/LICENSE\-2\.0\n  *\s*\n \*\s*Unless required by applicable law or agreed to in writing, software n \*\s*distributed under the License is distributed on an .AS IS. BASIS,\n \*\s*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.\n \*\s
*See the License for the specific language governing permissions and\n \*\s*limi
tations under the License\.\n \*/\s*"/>
+        </module>

-
         <!-- Checks for imports                              -->
         <!-- See http://checkstyle.sf.net/config_import.html -->
         <module name="AvoidStarImport"/>

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited July 3, 2006 10:47 pm by WendySmoak (diff)
Search: