<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- Content Stylesheet for Site --> <!-- start the processing --> <!-- ====================================================================== --> <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! --> <!-- Main Page Section --> <!-- ====================================================================== --> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" /> <meta name="author" content="Checkstyle Development Team"> <meta name="email" content="$au.getAttributeValue("email")"> <title>Checkstyle - Headers</title> <style type="text/css" media="all"> @import url("./css/cs-layout.css"); @import url("./css/cs-style.css"); </style> </head> <body> <div class="csTopBar"> <div class="csTopBarContents"> <div class="csLeft"> <h1>Headers</h1> </div> <div class="csRight"> <a href="http://checkstyle.sourceforge.net/"> <img src="images/logo.png" alt="Checkstyle Logo" height="70"/> </a> </div> </div> </div> <div class="csMiddleContainer"> <div class="csLeftBar"> <div class="csLeftBarContents"> <!-- ============================================================ --> <!-- start makeNavigationBar --> <ul> <li> <strong>About</strong> </li> <li> <a href="./index.html">Checkstyle</a> </li> <li> <strong>Documentation</strong> </li> <li> <a href="./releasenotes.html">Release Notes</a> </li> <li> <a href="./config.html">Configuration</a> </li> <li> <a href="./property_types.html"> Property Types</a> </li> <li> <a href="./running.html">Running</a> </li> <li> <a href="./anttask.html"> Ant Task</a> </li> <li> <a href="./cmdline.html"> Command Line</a> </li> <li> <a href="./availablechecks.html">Available Checks</a> </li> <li> <a href="./checks.html">Standard Checks</a> </li> <li> <a href="./config_javadoc.html"> Javadoc Comments</a> </li> <li> <a href="./config_naming.html"> Naming Conventions</a> </li> <li><b> <a href="./config_header.html"> Headers</a> </b></li> <li><a href="#Header"> Header</a></li> <li><a href="#RegexpHeader"> RegexpHeader</a></li> <li><a href="#CrossLanguageRegexpHeader"> CrossLanguageRegexpHeader</a></li> <li> <a href="./config_imports.html"> Imports</a> </li> <li> <a href="./config_sizes.html"> Size Violations</a> </li> <li> <a href="./config_whitespace.html"> Whitespace</a> </li> <li> <a href="./config_modifier.html"> Modifiers</a> </li> <li> <a href="./config_blocks.html"> Block Checks</a> </li> <li> <a href="./config_coding.html"> Coding</a> </li> <li> <a href="./config_design.html"> Class Design</a> </li> <li> <a href="./config_duplicates.html"> Duplicate Code</a> </li> <li> <a href="./config_metrics.html"> Metrics</a> </li> <li> <a href="./config_misc.html"> Miscellaneous</a> </li> <li> <a href="./optional.html">Optional Checks</a> </li> <li> <a href="./config_j2ee.html"> J2EE Checks</a> </li> <li> <a href="./extending.html">Extending Checkstyle</a> </li> <li> <a href="./writingchecks.html"> Writing checks</a> </li> <li> <a href="./writingfilters.html"> Writing filters</a> </li> <li> <a href="./writinglisteners.html"> Writing listeners</a> </li> <li> <a href="./api/index.html">Javadoc</a> </li> <li> <strong>SourceForge</strong> </li> <li> <a href="http://sourceforge.net/mail/?group_id=29721">Mailing Lists</a> </li> <li> <a href="http://sourceforge.net/tracker/?atid=397078&group_id=29721&func=browse">Bug Database</a> </li> <li> <a href="http://sourceforge.net/tracker/?atid=397081&group_id=29721&func=browse">Feature Requests</a> </li> <li> <strong>Developers</strong> </li> <li> <a href="http://sourceforge.net/projects/checkstyle">Project Page</a> </li> <li> <a href="http://checkstyle.svn.sourceforge.net/viewvc/checkstyle/">SVN Repository</a> </li> <li> <a href="./contributing.html">Contributing</a> </li> </ul> <ul> <li> <strong>Hosted by:</strong> <div align="center"> <p><a href="http://sourceforge.net"> <img src="http://sourceforge.net/sflogo.php?group_id=29721&type=1" width="88" height="31" alt="SourceForge Logo"/></a> </p> </div> </li> </ul> <!-- end makeNavigationBar --> <!-- ============================================================ --> </div> </div> <div class="csMain"> <a id="Header"></a> <h2>Header</h2> <h3>Description</h3> <p> Checks that a source file begins with a specified header. Property <span class="code"> headerFile</span> specifies a file that contains the required header. Alternatively, the header specification can be set directly in the <span class="code">header</span> property without the need for an external file. </p> <p> Property <span class="code">ignoreLines</span> specifies the line numbers to ignore when matching lines in a header file. This property is very useful for supporting headers that contain copyright dates. For example, consider the following header: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre>line 1: //////////////////////////////////////////////////////////////////// line 2: // checkstyle: line 3: // Checks Java source code for adherence to a set of rules. line 4: // Copyright (C) 2002 Oliver Burn line 5: ////////////////////////////////////////////////////////////////////</pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> Since the year information will change over time, you can tell Checkstyle to ignore line 4 by setting property <span class="code">ignoreLines</span> to <span class="code"> 4</span>. </p> <h3>Properties</h3> <table> <tr class="even"> <th valign="top" align="left" > name </th> <th valign="top" align="left" > description </th> <th valign="top" align="left" > type </th> <th valign="top" align="left" > default value </th> </tr> <tr class="odd"> <td class="odd" > headerFile </td> <td class="odd" > name of the file containing the required header </td> <td class="odd" > </td> <td class="odd" > </td> </tr> <tr class="even"> <td class="even" > header </td> <td class="even" > the required header specified inline. Individual header lines must be separated by the string <span class="code">"\n"</span> (even on platforms with a different line separator), see examples below. </td> <td class="even" > </td> <td class="even" > </td> </tr> <tr class="odd"> <td class="odd" > ignoreLines </td> <td class="odd" > line numbers to ignore </td> <td class="odd" > </td> <td class="odd" > </td> </tr> </table> <h3>Example</h3> <p> To configure the check to use header file <span class="code">"java.header"</span> and ignore lines <span class="code">2</span>, <span class="code">3</span>, and <span class="code"> 4</span>: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre><module name="Header"> <property name="headerFile" value="java.header"/> <property name="ignoreLines" value="2, 3, 4"/> </module></pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> To configure the check to verify that each file starts with the header </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre>// Copyright (C) 2004 MyCompany // All rights reserved</pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> without the need for an external header file: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre><module name="Header"> <property name="header" value="// Copyright (C) 2004 MyCompany\n// All rights reserved"/> </module></pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <h3>Package</h3> <p> com.puppycrawl.tools.checkstyle.checks.header </p> <h3>Parent Module</h3> <p> <a href="config.html#treewalker">TreeWalker</a> </p> <a id="RegexpHeader"></a> <h2>RegexpHeader</h2> <h3>Description</h3> <p> Checks the header of a java source file against a header that contains a <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html">regular expression</a> for each line of the source header. </p> <p> Rationale: In some projects <a href="#Header">checking against a fixed header</a> is not sufficient, e.g. the header might require a copyright line where the year information is not static. </p> <p> For example, consider the following header: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre>line 1: ^/{71}$ line 2: ^// checkstyle:$ line 3: ^// Checks Java source code for adherence to a set of rules\.$ line 4: ^// Copyright \(C\) \d\d\d\d Oliver Burn$ line 5: ^// Last modification by \$Author.*\$$ line 6: ^/{71}$ line 7: line 8: ^package line 9: line 10: ^import line 11: line 12: ^/\*\* line 13: ^ \*([^/]|$) line 14: ^ \*/</pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> Lines 1 and 6 demonstrate a more compact notation for 71 '/' characters. Line 4 enforces that the copyright notice includes a four digit year. Line 5 is an example how to enforce revision control keywords in a file header. Lines 12-14 is a template for javadoc (line 13 is so complicated to remove conflict with and of javadoc comment). </p> <h3>Properties</h3> <table> <tr class="even"> <th valign="top" align="left" > name </th> <th valign="top" align="left" > description </th> <th valign="top" align="left" > type </th> <th valign="top" align="left" > default value </th> </tr> <tr class="odd"> <td class="odd" > headerFile </td> <td class="odd" > name of the file containing the required header </td> <td class="odd" > </td> <td class="odd" > </td> </tr> <tr class="even"> <td class="even" > header </td> <td class="even" > the required header specified inline. Individual header lines must be separated by the string <span class="code">"\n"</span> (even on platforms with a different line separator), and regular expressions must not span multiple lines. </td> <td class="even" > </td> <td class="even" > </td> </tr> <tr class="odd"> <td class="odd" > multiLines </td> <td class="odd" > line numbers to repeat (zero or more times) </td> <td class="odd" > </td> <td class="odd" > </td> </tr> </table> <h3>Example</h3> <p> To configure the check to use header file <span class="code">"java.header"</span> and <span class="code">10</span> and <span class="code">13</span> muli-lines: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre><module name="RegexpHeader"> <property name="headerFile" value="java.header"/> <property name="multiLines" value="10, 13"/> </module></pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> To configure the check to verify that each file starts with the header </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre>^// Copyright \(C\) (\d\d\d\d -)? 2004 MyCompany$ ^// All rights reserved$</pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> without the need for an external header file: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre><module name="RegexpHeader"> <property name="header" value="^// Copyright \(C\) (\d\d\d\d -)? 2004 MyCompany$\n^// All rights reserved$"/> </module></pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> <u>Note</u>: <span class="code">ignoreLines</span> property has been removed from this check to simplify it. To make some line optional use "^.*$" regexp for this line. </p> <h3>Package</h3> <p> com.puppycrawl.tools.checkstyle.checks.header </p> <h3>Parent Module</h3> <p> <a href="config.html#treewalker">TreeWalker</a> </p> <a id="CrossLanguageRegexpHeader"></a> <h2>CrossLanguageRegexpHeader</h2> <h3>Description</h3> <p> Checks the header of each source file against a header that contains a <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html">regular expression</a> for each line of the source header. </p> <p> This check is very similar to the <a href="#RegexpHeader">RegexpHeader check</a> above. However it has <a href="config.html#checker">Checker</a> as it's parent module, so it is not limited to java source code, and allows checking headers of other file types as well. </p> <p> Different programming languages have different comment synatx rules, but all of them start a comment with a non-word character. Hence you can often use the non-word character class to abstract away the concrete comment syntax and allow checking the header for different languages with a single header definition. For example, consider the following header specification (note that this is not the full Apache licence header): </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre>line 1: ^#! line 2: ^<\?xml.*>$ line 3: ^\W*$ line 4: ^\W*Copyright 2006 The Apache Software Foundation or its licensors, as applicable\.$ line 5: ^\W*Licensed under the Apache License, Version 2\.0 \(the "License"\);$ line 6: ^\W*$</pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> Lines 1 and 2 leave room for technical header lines, e.g. the "#!/bin/sh" line in Unix shell scripts, or the xml file header of XML files. Set the multiline property to "1, 2" so these lines can be ignored for file types where they do no apply. Lines 3 throgh 6 define the actual header content. Note how lines 2, 4 and 5 use escapes for characters that have special regexp semantics. </p> <h3>Properties</h3> <table> <tr class="even"> <th valign="top" align="left" > name </th> <th valign="top" align="left" > description </th> <th valign="top" align="left" > type </th> <th valign="top" align="left" > default value </th> </tr> <tr class="odd"> <td class="odd" > charset </td> <td class="odd" > name of the file charset </td> <td class="odd" > </td> <td class="odd" > System property "file.encoding" </td> </tr> <tr class="even"> <td class="even" > fileExtensions </td> <td class="even" > file type extensions to identify the file types to check. Must only contain text files, not binary files like bitmap graphics. </td> <td class="even" > </td> <td class="even" > </td> </tr> <tr class="odd"> <td class="odd" > headerFile </td> <td class="odd" > name of the file containing the required header </td> <td class="odd" > </td> <td class="odd" > </td> </tr> <tr class="even"> <td class="even" > header </td> <td class="even" > the required header specified inline. Individual header lines must be separated by the string <span class="code">"\n"</span> (even on platforms with a different line separator), and regular expressions must not span multiple lines. </td> <td class="even" > </td> <td class="even" > </td> </tr> <tr class="odd"> <td class="odd" > multiLines </td> <td class="odd" > line numbers to repeat (zero or more times) </td> <td class="odd" > </td> <td class="odd" > </td> </tr> </table> <h3>Example</h3> <p> To configure the check to use header file <span class="code">"apache.header"</span> and <span class="code">1</span> and <span class="code">2</span> muli-lines: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre><module name="CrossLanguageRegexpHeader"> <property name="headerFile" value="apache.header"/> <property name="multiLines" value="1, 2"/> </module></pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> To configure the check to verify that each file starts with the header </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre>^// Copyright \(C\) (\d\d\d\d -)? 2004 MyCompany$ ^// All rights reserved$</pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> without the need for an external header file: </p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre><module name="CrossLanguageRegexpHeader"> <property name="header" value="^// Copyright \(C\) (\d\d\d\d -)? 2004 MyCompany$\n^// All rights reserved$"/> </module></pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <h3>Package</h3> <p> com.puppycrawl.tools.checkstyle.checks.header </p> <h3>Parent Module</h3> <p> <a href="config.html#checker">Checker</a> </p> </div> </div> <div class="csBottomBar"> <div class="csBottomBarContents"> Copyright © 2001-2007, Oliver Burn </div> </div> </body> </html> <!-- end the processing -->