You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-commits@maven.apache.org by de...@apache.org on 2015/05/02 12:15:10 UTC
svn commit: r949876 [9/17] - in
/websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST:
./ apidocs/ config/ css/ examples/ images/ testapidocs/ xref-test/ xref/
Modified: websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/custom-developed-checkstyle.html
==============================================================================
--- websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/custom-developed-checkstyle.html (original)
+++ websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/custom-developed-checkstyle.html Sat May 2 10:15:09 2015
@@ -1,386 +1,394 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!--
- | Generated by Apache Maven Doxia at 2015-04-11
- | Rendered using Apache Maven Stylus Skin 1.5
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Apache Maven Checkstyle Plugin – Using Custom Developed Checkstyle Checks</title>
- <style type="text/css" media="all">
- @import url("../css/maven-base.css");
- @import url("../css/maven-theme.css");
- @import url("../css/site.css");
- </style>
- <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
- <meta name="author" content="2008-02-04" />
- <meta name="Date-Revision-yyyymmdd" content="20150411" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-
-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
-
-<script type="text/javascript">_uacct = "UA-140879-1";
- urchinTracker();</script>
- </head>
- <body class="composite">
- <div id="banner">
- <a href="../../../" id="bannerLeft">
- <img src="../../../images/apache-maven-project-2.png" alt="" />
- </a>
- <span id="bannerRight">
- <img src="../../../images/maven-logo-2.gif" alt="" />
- </span>
- <div class="clear">
- <hr/>
- </div>
- </div>
- <div id="breadcrumbs">
-
- <div class="xleft">
- <a href="http://www.apache.org/" class="externalLink">Apache</a>
- >
- <a href="../../../index.html">Maven</a>
- >
- <a href="../../index.html">Plugins</a>
- >
- <a href="../">Apache Maven Checkstyle Plugin</a>
- >
- Using Custom Developed Checkstyle Checks
- </div>
- <div class="xright">
- Last Published: 2015-04-11
- | Version: 2.16-SNAPSHOT
- </div>
- <div class="clear">
- <hr/>
- </div>
- </div>
- <div id="leftColumn">
- <div id="navcolumn">
-
- <h5>Overview</h5>
- <ul>
- <li class="none">
- <a href="../index.html">Introduction</a>
- </li>
- <li class="none">
- <a href="../plugin-info.html">Goals</a>
- </li>
- <li class="none">
- <a href="../usage.html">Usage</a>
- </li>
- <li class="none">
- <a href="../faq.html">FAQ</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/licenses/" class="externalLink">License</a>
- </li>
- <li class="none">
- <a href="../download.html">Download</a>
- </li>
- <li class="none">
- <a href="../history.html">Releases History</a>
- </li>
- </ul>
- <h5>Examples</h5>
- <ul>
- <li class="none">
- <a href="../examples/upgrading-checkstyle.html">Upgrading Checkstyle at Runtime</a>
- </li>
- <li class="none">
- <a href="../examples/inline-checker-config.html">Using an Inline Checkstyle Checker Configuration</a>
- </li>
- <li class="none">
- <a href="../examples/custom-checker-config.html">Using a Custom Checkstyle Checker Configuration</a>
- </li>
- <li class="none">
- <a href="../examples/custom-property-expansion.html">Using Custom Checkstyle Property Expansion Definitions</a>
- </li>
- <li class="none">
- <a href="../examples/suppressions-filter.html">Using a Suppressions Filter</a>
- </li>
- <li class="none">
- <strong>Using Custom Developed Checkstyle Checks</strong>
- </li>
- <li class="none">
- <a href="../examples/multi-module-config.html">Multimodule Configuration</a>
- </li>
- </ul>
- <h5>Project Documentation</h5>
- <ul>
- <li class="collapsed">
- <a href="../project-info.html">Project Information</a>
- </li>
- <li class="collapsed">
- <a href="../project-reports.html">Project Reports</a>
- </li>
- </ul>
- <h5>Maven Projects</h5>
- <ul>
- <li class="none">
- <a href="../../../ant-tasks/index.html">Ant Tasks</a>
- </li>
- <li class="none">
- <a href="../../../archetype/index.html">Archetype</a>
- </li>
- <li class="none">
- <a href="../../../doxia/index.html">Doxia</a>
- </li>
- <li class="none">
- <a href="../../../jxr/index.html">JXR</a>
- </li>
- <li class="none">
- <a href="../../../ref/current">Maven</a>
- </li>
- <li class="none">
- <a href="../../../pom/index.html">Parent POMs</a>
- </li>
- <li class="none">
- <a href="../../index.html">Plugins</a>
- </li>
- <li class="none">
- <a href="../../../plugin-testing/index.html">Plugin Testing</a>
- </li>
- <li class="none">
- <a href="../../../plugin-tools/index.html">Plugin Tools</a>
- </li>
- <li class="none">
- <a href="../../../apache-resource-bundles/index.html">Resource Bundles</a>
- </li>
- <li class="none">
- <a href="../../../scm/index.html">SCM</a>
- </li>
- <li class="none">
- <a href="../../../shared/index.html">Shared Components</a>
- </li>
- <li class="none">
- <a href="../../../skins/index.html">Skins</a>
- </li>
- <li class="none">
- <a href="../../../surefire/index.html">Surefire</a>
- </li>
- <li class="none">
- <a href="../../../wagon/index.html">Wagon</a>
- </li>
- </ul>
- <h5>ASF</h5>
- <ul>
- <li class="none">
- <a href="http://www.apache.org/foundation/how-it-works.html" class="externalLink">How Apache Works</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/foundation/" class="externalLink">Foundation</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsoring Apache</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks</a>
- </li>
- </ul>
- <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
- <img alt="Built by Maven" src="../images/logos/maven-feather.png"/>
- </a>
-
- </div>
- </div>
- <div id="bodyColumn">
- <div id="contentBox">
- <!-- 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 --><div class="section">
-<h2><a name="Using_Custom_Developed_Checkstyle_Checks"></a>Using Custom Developed Checkstyle Checks</h2>
-<p>We will guide you through creating a Maven project that produces a jar file of your custom checks. Then we'll include it in one of your projects by adding it as a dependency to the Checkstyle Plugin.</p>
-<p>The plugin also provides the ability to define the <a class="externalLink" href="http://checkstyle.sourceforge.net/config.html#Packages">package names XML document</a> required to reference your custom check modules more easily.</p>
-<p>In this example we will be using the <a class="externalLink" href="http://checkstyle.sourceforge.net/writingchecks.html#Visitor%20in%20action">example check</a> that can be found on the Checkstyle web site.</p>
-<div class="section">
-<h3><a name="Structuring_your_project"></a>Structuring your project</h3>
-<p>First we set up the directory structure for the custom ckecks project. It looks like this:</p>
-<div class="source">
-<pre>mycompany-checkstyle-checks
-|-- pom.xml
-`-- src
- `-- main
- `-- java
- `-- com
- `-- mycompany
- `-- checks
- |-- packagenames.xml
- `-- MethodLimitCheck.java</pre></div>
-<p>Now we'll go through each of the three files one at a time.</p>
-<div class="section">
-<h4><a name="pom.xml"></a><tt>pom.xml</tt></h4>
-<p>Not much to say here, except that we add a dependency on Checkstyle.</p>
-<div class="source">
-<pre><project>
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.mycompany</groupId>
- <artifactId>mycompany-checkstyle-checks</artifactId>
- <name>MyCompany Checkstyle Checks</name>
- <version>1.0</version>
- <dependencies>
- <dependency>
- <groupId>checkstyle</groupId>
- <artifactId>checkstyle</artifactId>
- <version>2.16-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project></pre></div></div>
-<div class="section">
-<h4><a name="packagenames.xml"></a><tt>packagenames.xml</tt></h4>
-<p>This file lets you specify the names of the packages that you want to be able to use. Here we have added <tt>com.mycompany.checks</tt> to the standard set of Checkstyle packages. That means that you can use your custom checks in the Checkstyle configuration file, without having to specify their package name.</p>
-<div class="source">
-<pre><?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE checkstyle-packages PUBLIC
- "-//Puppy Crawl//DTD Package Names 1.0//EN"
- "http://www.puppycrawl.com/dtds/packages_1_0.dtd">
-
-<checkstyle-packages>
- <package name="com.mycompany.checks"/>
- <package name="com.puppycrawl.tools.checkstyle">
- <package name="checks">
- <package name="blocks"/>
- <package name="coding"/>
- <package name="design"/>
- <package name="duplicates"/>
- <package name="header"/>
- <package name="imports"/>
- <package name="indentation"/>
- <package name="j2ee"/>
- <package name="javadoc"/>
- <package name="metrics"/>
- <package name="modifier"/>
- <package name="naming"/>
- <package name="sizes"/>
- <package name="whitespace"/>
- </package>
- <package name="filters"/>
- </package>
-</checkstyle-packages></pre></div></div>
-<div class="section">
-<h4><a name="MethodLimitCheck.java"></a><tt>MethodLimitCheck.java</tt></h4>
-<p>Here is the example check from the Checkstyle site. It checks that your source files don't have more that 30 methods.</p>
-<div class="source">
-<pre>package com.mycompany.checks;
-import com.puppycrawl.tools.checkstyle.api.*;
-
-public class MethodLimitCheck extends Check
-{
- private int max = 30;
-
- public int[] getDefaultTokens()
- {
- return new int[]{TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF};
- }
-
- public void visitToken(DetailAST ast)
- {
- // find the OBJBLOCK node below the CLASS_DEF/INTERFACE_DEF
- DetailAST objBlock = ast.findFirstToken(TokenTypes.OBJBLOCK);
- // count the number of direct children of the OBJBLOCK
- // that are METHOD_DEFS
- int methodDefs = objBlock.getChildCount(TokenTypes.METHOD_DEF);
- // report error if limit is reached
- if (methodDefs > max) {
- log(ast.getLineNo(),
- "too many methods, only " + max + " are allowed");
- }
- }
-}</pre></div></div></div>
-<div class="section">
-<h3><a name="Building_a_JAR_for_your_custom_checks_project"></a>Building a JAR for your custom checks project</h3>
-<p>To be able to use your custom checks in other projects, you need to package and install them. To do that, just run this on the command line:</p>
-<div class="source">
-<pre>mvn install</pre></div>
-<p>This produces a JAR file with the following contents and installs it into your local repository.</p>
-<div class="section">
-<h4><a name="mycompany-checkstyle-checks-1.0.jar"></a><tt>mycompany-checkstyle-checks-1.0.jar</tt></h4>
-<div class="source">
-<pre>mycompany-checkstyle-checks-1.0.jar
-|-- pom.xml
-|-- META-INF
-| |-- MANIFEST.MF
-| `-- maven
-| `-- com.mycompany
-| `-- mycompany-checkstyle-checks
-| |-- pom.xml
-| `-- pom.properties
-`-- com
- `-- mycompany
- `-- checks
- |-- packagenames.xml
- `-- MethodLimitCheck.class</pre></div></div></div>
-<div class="section">
-<h3><a name="Using_your_checks_in_another_project"></a>Using your checks in another project</h3>
-<p>Now you are ready to make use of your custom checks in another project.</p>
-<div class="section">
-<h4><a name="Create_a_Checkstyle_configuration"></a>Create a Checkstyle configuration</h4>
-<p>Create the file <tt>checkstyle.xml</tt> in the root of the project that wants to use your custom checks. In this file you tell Checkstyle which checks you want to use.</p>
-<p><b>Note:</b> We don't have to specify the fully qualified classname of our check here. That's because we used the <tt>packagenames.xml</tt> file earlier.</p>
-<div class="source">
-<pre><?xml version="1.0" ?>
-
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
- <module name="TreeWalker">
- <module name="MethodLimit"/>
- </module>
-</module></pre></div></div>
-<div class="section">
-<h4><a name="Configure_the_Checkstyle_Plugin_to_use_your_custom_checks"></a>Configure the Checkstyle Plugin to use your custom checks</h4>
-<p>Finally we need to tell the other project that you want it to use your custom Checkstyle checks. In the <tt>pom.xml</tt> of that project, add the following configuration.</p>
-<p><b>Note:</b> You have to specify a plugin dependency on <tt>mycompany-checkstyle-checks</tt> in the <tt><build></tt> element of your <tt>pom.xml</tt>. It will not work inside the <tt><reporting></tt> element, because <tt><reporting></tt> does not support plugin dependencies. The rest of the configuration is done in the normal way in the <tt><reporting></tt> element.</p>
-<div class="source">
-<pre><project>
- ...
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.16-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>com.mycompany</groupId>
- <artifactId>mycompany-checkstyle-checks</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.16-SNAPSHOT</version>
- <configuration>
- <configLocation>checkstyle.xml</configLocation>
- <packageNamesLocation>com/mycompany/checks/packagenames.xml</packageNamesLocation>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- ...
-</project></pre></div></div></div></div>
- </div>
- </div>
- <div class="clear">
- <hr/>
- </div>
- <div id="footer">
- <div class="xright">
- © 2005-2015
- The Apache Software Foundation
-
- - <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a>.
- Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.
- </div>
- <div class="clear">
- <hr/>
- </div>
- </div>
- </body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ | Generated by Apache Maven Doxia at 2015-05-02
+ | Rendered using Apache Maven Stylus Skin 1.5
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Apache Maven Checkstyle Plugin – Using Custom Developed Checkstyle Checks</title>
+ <style type="text/css" media="all">
+ @import url("../css/maven-base.css");
+ @import url("../css/maven-theme.css");
+ @import url("../css/site.css");
+ </style>
+ <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
+ <meta name="author" content="2008-02-04" />
+ <meta name="Date-Revision-yyyymmdd" content="20150502" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
+
+<script type="text/javascript">_uacct = "UA-140879-1";
+ urchinTracker();</script>
+ </head>
+ <body class="composite">
+ <div id="banner">
+ <a href="../../../" id="bannerLeft">
+ <img src="../../../images/apache-maven-project-2.png" alt="" />
+ </a>
+ <span id="bannerRight">
+ <img src="../../../images/maven-logo-2.gif" alt="" />
+ </span>
+ <div class="clear">
+ <hr/>
+ </div>
+ </div>
+ <div id="breadcrumbs">
+
+ <div class="xleft">
+ <a href="http://www.apache.org/" class="externalLink">Apache</a>
+ >
+ <a href="../../../index.html">Maven</a>
+ >
+ <a href="../../index.html">Plugins</a>
+ >
+ <a href="../">Apache Maven Checkstyle Plugin</a>
+ >
+ Using Custom Developed Checkstyle Checks
+ </div>
+ <div class="xright">
+ Last Published: 2015-05-02
+ | Version: 2.16-SNAPSHOT
+ </div>
+ <div class="clear">
+ <hr/>
+ </div>
+ </div>
+ <div id="leftColumn">
+ <div id="navcolumn">
+
+ <h5>Overview</h5>
+ <ul>
+ <li class="none">
+ <a href="../index.html">Introduction</a>
+ </li>
+ <li class="none">
+ <a href="../plugin-info.html">Goals</a>
+ </li>
+ <li class="none">
+ <a href="../usage.html">Usage</a>
+ </li>
+ <li class="none">
+ <a href="../faq.html">FAQ</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/licenses/" class="externalLink">License</a>
+ </li>
+ <li class="none">
+ <a href="../download.html">Download</a>
+ </li>
+ <li class="none">
+ <a href="../history.html">Releases History</a>
+ </li>
+ </ul>
+ <h5>Examples</h5>
+ <ul>
+ <li class="none">
+ <a href="../examples/upgrading-checkstyle.html">Upgrading Checkstyle at Runtime</a>
+ </li>
+ <li class="none">
+ <a href="../examples/inline-checker-config.html">Using an Inline Checkstyle Checker Configuration</a>
+ </li>
+ <li class="none">
+ <a href="../examples/custom-checker-config.html">Using a Custom Checkstyle Checker Configuration</a>
+ </li>
+ <li class="none">
+ <a href="../examples/custom-property-expansion.html">Using Custom Checkstyle Property Expansion Definitions</a>
+ </li>
+ <li class="none">
+ <a href="../examples/suppressions-filter.html">Using a Suppressions Filter</a>
+ </li>
+ <li class="none">
+ <strong>Using Custom Developed Checkstyle Checks</strong>
+ </li>
+ <li class="none">
+ <a href="../examples/multi-module-config.html">Multimodule Configuration</a>
+ </li>
+ </ul>
+ <h5>Project Documentation</h5>
+ <ul>
+ <li class="collapsed">
+ <a href="../project-info.html">Project Information</a>
+ </li>
+ <li class="collapsed">
+ <a href="../project-reports.html">Project Reports</a>
+ </li>
+ </ul>
+ <h5>Maven Projects</h5>
+ <ul>
+ <li class="none">
+ <a href="../../../ant-tasks/index.html">Ant Tasks</a>
+ </li>
+ <li class="none">
+ <a href="../../../archetype/index.html">Archetype</a>
+ </li>
+ <li class="none">
+ <a href="../../../doxia/index.html">Doxia</a>
+ </li>
+ <li class="none">
+ <a href="../../../jxr/index.html">JXR</a>
+ </li>
+ <li class="none">
+ <a href="../../../ref/current">Maven</a>
+ </li>
+ <li class="none">
+ <a href="../../../pom/index.html">Parent POMs</a>
+ </li>
+ <li class="none">
+ <a href="../../index.html">Plugins</a>
+ </li>
+ <li class="none">
+ <a href="../../../plugin-testing/index.html">Plugin Testing</a>
+ </li>
+ <li class="none">
+ <a href="../../../plugin-tools/index.html">Plugin Tools</a>
+ </li>
+ <li class="none">
+ <a href="../../../apache-resource-bundles/index.html">Resource Bundles</a>
+ </li>
+ <li class="none">
+ <a href="../../../scm/index.html">SCM</a>
+ </li>
+ <li class="none">
+ <a href="../../../shared/index.html">Shared Components</a>
+ </li>
+ <li class="none">
+ <a href="../../../skins/index.html">Skins</a>
+ </li>
+ <li class="none">
+ <a href="../../../surefire/index.html">Surefire</a>
+ </li>
+ <li class="none">
+ <a href="../../../wagon/index.html">Wagon</a>
+ </li>
+ </ul>
+ <h5>ASF</h5>
+ <ul>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/how-it-works.html" class="externalLink">How Apache Works</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/" class="externalLink">Foundation</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsoring Apache</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks</a>
+ </li>
+ </ul>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+ <img alt="Built by Maven" src="../images/logos/maven-feather.png"/>
+ </a>
+
+ </div>
+ </div>
+ <div id="bodyColumn">
+ <div id="contentBox">
+ <!-- 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 --><div class="section">
+<h2><a name="Using_Custom_Developed_Checkstyle_Checks"></a>Using Custom Developed Checkstyle Checks</h2>
+<p>We will guide you through creating a Maven project that produces a jar file of your custom checks. Then we'll include it in one of your projects by adding it as a dependency to the Checkstyle Plugin.</p>
+<p>The plugin also provides the ability to define the <a class="externalLink" href="http://checkstyle.sourceforge.net/config.html#Packages">package names XML document</a> required to reference your custom check modules more easily.</p>
+<p>In this example we will be using the <a class="externalLink" href="http://checkstyle.sourceforge.net/writingchecks.html#Visitor%20in%20action">example check</a> that can be found on the Checkstyle web site.</p>
+<div class="section">
+<h3><a name="Structuring_your_project"></a>Structuring your project</h3>
+<p>First we set up the directory structure for the custom ckecks project. It looks like this:</p>
+<div class="source">
+<pre>mycompany-checkstyle-checks
+|-- pom.xml
+`-- src
+ `-- main
+ `-- java
+ `-- com
+ `-- mycompany
+ `-- checks
+ |-- packagenames.xml
+ `-- MethodLimitCheck.java
+</pre></div>
+<p>Now we'll go through each of the three files one at a time.</p>
+<div class="section">
+<h4><a name="pom.xml"></a><tt>pom.xml</tt></h4>
+<p>Not much to say here, except that we add a dependency on Checkstyle.</p>
+<div class="source">
+<pre><project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.mycompany</groupId>
+ <artifactId>mycompany-checkstyle-checks</artifactId>
+ <name>MyCompany Checkstyle Checks</name>
+ <version>1.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>checkstyle</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>2.16-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
+</pre></div></div>
+<div class="section">
+<h4><a name="packagenames.xml"></a><tt>packagenames.xml</tt></h4>
+<p>This file lets you specify the names of the packages that you want to be able to use. Here we have added <tt>com.mycompany.checks</tt> to the standard set of Checkstyle packages. That means that you can use your custom checks in the Checkstyle configuration file, without having to specify their package name.</p>
+<div class="source">
+<pre><?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE checkstyle-packages PUBLIC
+ "-//Puppy Crawl//DTD Package Names 1.0//EN"
+ "http://www.puppycrawl.com/dtds/packages_1_0.dtd">
+
+<checkstyle-packages>
+ <package name="com.mycompany.checks"/>
+ <package name="com.puppycrawl.tools.checkstyle">
+ <package name="checks">
+ <package name="blocks"/>
+ <package name="coding"/>
+ <package name="design"/>
+ <package name="duplicates"/>
+ <package name="header"/>
+ <package name="imports"/>
+ <package name="indentation"/>
+ <package name="j2ee"/>
+ <package name="javadoc"/>
+ <package name="metrics"/>
+ <package name="modifier"/>
+ <package name="naming"/>
+ <package name="sizes"/>
+ <package name="whitespace"/>
+ </package>
+ <package name="filters"/>
+ </package>
+</checkstyle-packages>
+</pre></div></div>
+<div class="section">
+<h4><a name="MethodLimitCheck.java"></a><tt>MethodLimitCheck.java</tt></h4>
+<p>Here is the example check from the Checkstyle site. It checks that your source files don't have more that 30 methods.</p>
+<div class="source">
+<pre>package com.mycompany.checks;
+import com.puppycrawl.tools.checkstyle.api.*;
+
+public class MethodLimitCheck extends Check
+{
+ private int max = 30;
+
+ public int[] getDefaultTokens()
+ {
+ return new int[]{TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF};
+ }
+
+ public void visitToken(DetailAST ast)
+ {
+ // find the OBJBLOCK node below the CLASS_DEF/INTERFACE_DEF
+ DetailAST objBlock = ast.findFirstToken(TokenTypes.OBJBLOCK);
+ // count the number of direct children of the OBJBLOCK
+ // that are METHOD_DEFS
+ int methodDefs = objBlock.getChildCount(TokenTypes.METHOD_DEF);
+ // report error if limit is reached
+ if (methodDefs > max) {
+ log(ast.getLineNo(),
+ "too many methods, only " + max + " are allowed");
+ }
+ }
+}
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Building_a_JAR_for_your_custom_checks_project"></a>Building a JAR for your custom checks project</h3>
+<p>To be able to use your custom checks in other projects, you need to package and install them. To do that, just run this on the command line:</p>
+<div class="source">
+<pre>mvn install
+</pre></div>
+<p>This produces a JAR file with the following contents and installs it into your local repository.</p>
+<div class="section">
+<h4><a name="mycompany-checkstyle-checks-1.0.jar"></a><tt>mycompany-checkstyle-checks-1.0.jar</tt></h4>
+<div class="source">
+<pre>mycompany-checkstyle-checks-1.0.jar
+|-- pom.xml
+|-- META-INF
+| |-- MANIFEST.MF
+| `-- maven
+| `-- com.mycompany
+| `-- mycompany-checkstyle-checks
+| |-- pom.xml
+| `-- pom.properties
+`-- com
+ `-- mycompany
+ `-- checks
+ |-- packagenames.xml
+ `-- MethodLimitCheck.class
+</pre></div></div></div>
+<div class="section">
+<h3><a name="Using_your_checks_in_another_project"></a>Using your checks in another project</h3>
+<p>Now you are ready to make use of your custom checks in another project.</p>
+<div class="section">
+<h4><a name="Create_a_Checkstyle_configuration"></a>Create a Checkstyle configuration</h4>
+<p>Create the file <tt>checkstyle.xml</tt> in the root of the project that wants to use your custom checks. In this file you tell Checkstyle which checks you want to use.</p>
+<p><b>Note:</b> We don't have to specify the fully qualified classname of our check here. That's because we used the <tt>packagenames.xml</tt> file earlier.</p>
+<div class="source">
+<pre><?xml version="1.0" ?>
+
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<module name="Checker">
+ <module name="TreeWalker">
+ <module name="MethodLimit"/>
+ </module>
+</module>
+</pre></div></div>
+<div class="section">
+<h4><a name="Configure_the_Checkstyle_Plugin_to_use_your_custom_checks"></a>Configure the Checkstyle Plugin to use your custom checks</h4>
+<p>Finally we need to tell the other project that you want it to use your custom Checkstyle checks. In the <tt>pom.xml</tt> of that project, add the following configuration.</p>
+<p><b>Note:</b> You have to specify a plugin dependency on <tt>mycompany-checkstyle-checks</tt> in the <tt><build></tt> element of your <tt>pom.xml</tt>. It will not work inside the <tt><reporting></tt> element, because <tt><reporting></tt> does not support plugin dependencies. The rest of the configuration is done in the normal way in the <tt><reporting></tt> element.</p>
+<div class="source">
+<pre><project>
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.16-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>com.mycompany</groupId>
+ <artifactId>mycompany-checkstyle-checks</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.16-SNAPSHOT</version>
+ <configuration>
+ <configLocation>checkstyle.xml</configLocation>
+ <packageNamesLocation>com/mycompany/checks/packagenames.xml</packageNamesLocation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ ...
+</project>
+</pre></div></div></div></div>
+ </div>
+ </div>
+ <div class="clear">
+ <hr/>
+ </div>
+ <div id="footer">
+ <div class="xright">
+ © 2005-2015
+ The Apache Software Foundation
+
+ - <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a>.
+ Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.
+ </div>
+ <div class="clear">
+ <hr/>
+ </div>
+ </div>
+ </body>
</html>
\ No newline at end of file
Modified: websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/custom-property-expansion.html
==============================================================================
--- websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/custom-property-expansion.html (original)
+++ websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/custom-property-expansion.html Sat May 2 10:15:09 2015
@@ -1,264 +1,267 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!--
- | Generated by Apache Maven Doxia at 2015-04-11
- | Rendered using Apache Maven Stylus Skin 1.5
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Apache Maven Checkstyle Plugin – Using Custom Checkstyle Property Expansion Definitions</title>
- <style type="text/css" media="all">
- @import url("../css/maven-base.css");
- @import url("../css/maven-theme.css");
- @import url("../css/site.css");
- </style>
- <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
- <meta name="author" content="2006-07-21" />
- <meta name="Date-Revision-yyyymmdd" content="20150411" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-
-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
-
-<script type="text/javascript">_uacct = "UA-140879-1";
- urchinTracker();</script>
- </head>
- <body class="composite">
- <div id="banner">
- <a href="../../../" id="bannerLeft">
- <img src="../../../images/apache-maven-project-2.png" alt="" />
- </a>
- <span id="bannerRight">
- <img src="../../../images/maven-logo-2.gif" alt="" />
- </span>
- <div class="clear">
- <hr/>
- </div>
- </div>
- <div id="breadcrumbs">
-
- <div class="xleft">
- <a href="http://www.apache.org/" class="externalLink">Apache</a>
- >
- <a href="../../../index.html">Maven</a>
- >
- <a href="../../index.html">Plugins</a>
- >
- <a href="../">Apache Maven Checkstyle Plugin</a>
- >
- Using Custom Checkstyle Property Expansion Definitions
- </div>
- <div class="xright">
- Last Published: 2015-04-11
- | Version: 2.16-SNAPSHOT
- </div>
- <div class="clear">
- <hr/>
- </div>
- </div>
- <div id="leftColumn">
- <div id="navcolumn">
-
- <h5>Overview</h5>
- <ul>
- <li class="none">
- <a href="../index.html">Introduction</a>
- </li>
- <li class="none">
- <a href="../plugin-info.html">Goals</a>
- </li>
- <li class="none">
- <a href="../usage.html">Usage</a>
- </li>
- <li class="none">
- <a href="../faq.html">FAQ</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/licenses/" class="externalLink">License</a>
- </li>
- <li class="none">
- <a href="../download.html">Download</a>
- </li>
- <li class="none">
- <a href="../history.html">Releases History</a>
- </li>
- </ul>
- <h5>Examples</h5>
- <ul>
- <li class="none">
- <a href="../examples/upgrading-checkstyle.html">Upgrading Checkstyle at Runtime</a>
- </li>
- <li class="none">
- <a href="../examples/inline-checker-config.html">Using an Inline Checkstyle Checker Configuration</a>
- </li>
- <li class="none">
- <a href="../examples/custom-checker-config.html">Using a Custom Checkstyle Checker Configuration</a>
- </li>
- <li class="none">
- <strong>Using Custom Checkstyle Property Expansion Definitions</strong>
- </li>
- <li class="none">
- <a href="../examples/suppressions-filter.html">Using a Suppressions Filter</a>
- </li>
- <li class="none">
- <a href="../examples/custom-developed-checkstyle.html">Using Custom Developed Checkstyle Checks</a>
- </li>
- <li class="none">
- <a href="../examples/multi-module-config.html">Multimodule Configuration</a>
- </li>
- </ul>
- <h5>Project Documentation</h5>
- <ul>
- <li class="collapsed">
- <a href="../project-info.html">Project Information</a>
- </li>
- <li class="collapsed">
- <a href="../project-reports.html">Project Reports</a>
- </li>
- </ul>
- <h5>Maven Projects</h5>
- <ul>
- <li class="none">
- <a href="../../../ant-tasks/index.html">Ant Tasks</a>
- </li>
- <li class="none">
- <a href="../../../archetype/index.html">Archetype</a>
- </li>
- <li class="none">
- <a href="../../../doxia/index.html">Doxia</a>
- </li>
- <li class="none">
- <a href="../../../jxr/index.html">JXR</a>
- </li>
- <li class="none">
- <a href="../../../ref/current">Maven</a>
- </li>
- <li class="none">
- <a href="../../../pom/index.html">Parent POMs</a>
- </li>
- <li class="none">
- <a href="../../index.html">Plugins</a>
- </li>
- <li class="none">
- <a href="../../../plugin-testing/index.html">Plugin Testing</a>
- </li>
- <li class="none">
- <a href="../../../plugin-tools/index.html">Plugin Tools</a>
- </li>
- <li class="none">
- <a href="../../../apache-resource-bundles/index.html">Resource Bundles</a>
- </li>
- <li class="none">
- <a href="../../../scm/index.html">SCM</a>
- </li>
- <li class="none">
- <a href="../../../shared/index.html">Shared Components</a>
- </li>
- <li class="none">
- <a href="../../../skins/index.html">Skins</a>
- </li>
- <li class="none">
- <a href="../../../surefire/index.html">Surefire</a>
- </li>
- <li class="none">
- <a href="../../../wagon/index.html">Wagon</a>
- </li>
- </ul>
- <h5>ASF</h5>
- <ul>
- <li class="none">
- <a href="http://www.apache.org/foundation/how-it-works.html" class="externalLink">How Apache Works</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/foundation/" class="externalLink">Foundation</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsoring Apache</a>
- </li>
- <li class="none">
- <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks</a>
- </li>
- </ul>
- <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
- <img alt="Built by Maven" src="../images/logos/maven-feather.png"/>
- </a>
-
- </div>
- </div>
- <div id="bodyColumn">
- <div id="contentBox">
- <!-- 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 --><div class="section">
-<h2><a name="Using_Custom_Checkstyle_Property_Expansion_Definitions"></a>Using Custom Checkstyle Property Expansion Definitions</h2>
-<p>Custom <a class="externalLink" href="http://checkstyle.sourceforge.net/config.html#Properties">property expansion definitions</a> for the Checker can be defined.</p>
-<p>Checkstyle uses the property expansion mechanism to allow injection of specific values into a pre-defined Checker configuration. Using property expansion alone is an insufficient means to customize the checks performed by Checkstyle.</p>
-<p>Example: <tt>checkstyle.xml</tt> - only checks the package name in use to ensure that it conforms to the desired scheme, but allows for users of this Checker to specify their own projectname.</p>
-<div class="source">
-<pre><?xml version="1.0" ?>
-
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
- <module name="TreeWalker">
- <module name="PackageName">
- <property name="format"
- value="com\.example\.$\{projectname\}(\.[a-z][a-zA-Z0-9]+)*$"/>
- </module>
- </module>
-</module></pre></div>
-<p>Example: <tt>pom.xml</tt> - Specifies the <tt>projectname</tt> property expansion that Checkstyle will use when encountering such a variable in the above Checker configuration.</p>
-<div class="source">
-<pre><project>
- ...
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.16-SNAPSHOT</version>
- <configuration>
- <configLocation>checkstyle.xml</configLocation>
- <propertyExpansion>projectname=whizbang</propertyExpansion>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- ...
-</project></pre></div>
-<p>The property expansion information can also come from a location using the <tt>propertiesLocation</tt> parameter as shown below. The <tt>propertiesLocation</tt> can point to a URL, File or build classpath resource reference.</p>
-<div class="source">
-<pre><project>
- ...
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.16-SNAPSHOT</version>
- <configuration>
- <configLocation>checkstyle.xml</configLocation>
- <propertesLocation>${basedir}/checkstyle.properties</propertiesLocation>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- ...
-</project></pre></div></div>
- </div>
- </div>
- <div class="clear">
- <hr/>
- </div>
- <div id="footer">
- <div class="xright">
- © 2005-2015
- The Apache Software Foundation
-
- - <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a>.
- Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.
- </div>
- <div class="clear">
- <hr/>
- </div>
- </div>
- </body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ | Generated by Apache Maven Doxia at 2015-05-02
+ | Rendered using Apache Maven Stylus Skin 1.5
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Apache Maven Checkstyle Plugin – Using Custom Checkstyle Property Expansion Definitions</title>
+ <style type="text/css" media="all">
+ @import url("../css/maven-base.css");
+ @import url("../css/maven-theme.css");
+ @import url("../css/site.css");
+ </style>
+ <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
+ <meta name="author" content="2006-07-21" />
+ <meta name="Date-Revision-yyyymmdd" content="20150502" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
+
+<script type="text/javascript">_uacct = "UA-140879-1";
+ urchinTracker();</script>
+ </head>
+ <body class="composite">
+ <div id="banner">
+ <a href="../../../" id="bannerLeft">
+ <img src="../../../images/apache-maven-project-2.png" alt="" />
+ </a>
+ <span id="bannerRight">
+ <img src="../../../images/maven-logo-2.gif" alt="" />
+ </span>
+ <div class="clear">
+ <hr/>
+ </div>
+ </div>
+ <div id="breadcrumbs">
+
+ <div class="xleft">
+ <a href="http://www.apache.org/" class="externalLink">Apache</a>
+ >
+ <a href="../../../index.html">Maven</a>
+ >
+ <a href="../../index.html">Plugins</a>
+ >
+ <a href="../">Apache Maven Checkstyle Plugin</a>
+ >
+ Using Custom Checkstyle Property Expansion Definitions
+ </div>
+ <div class="xright">
+ Last Published: 2015-05-02
+ | Version: 2.16-SNAPSHOT
+ </div>
+ <div class="clear">
+ <hr/>
+ </div>
+ </div>
+ <div id="leftColumn">
+ <div id="navcolumn">
+
+ <h5>Overview</h5>
+ <ul>
+ <li class="none">
+ <a href="../index.html">Introduction</a>
+ </li>
+ <li class="none">
+ <a href="../plugin-info.html">Goals</a>
+ </li>
+ <li class="none">
+ <a href="../usage.html">Usage</a>
+ </li>
+ <li class="none">
+ <a href="../faq.html">FAQ</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/licenses/" class="externalLink">License</a>
+ </li>
+ <li class="none">
+ <a href="../download.html">Download</a>
+ </li>
+ <li class="none">
+ <a href="../history.html">Releases History</a>
+ </li>
+ </ul>
+ <h5>Examples</h5>
+ <ul>
+ <li class="none">
+ <a href="../examples/upgrading-checkstyle.html">Upgrading Checkstyle at Runtime</a>
+ </li>
+ <li class="none">
+ <a href="../examples/inline-checker-config.html">Using an Inline Checkstyle Checker Configuration</a>
+ </li>
+ <li class="none">
+ <a href="../examples/custom-checker-config.html">Using a Custom Checkstyle Checker Configuration</a>
+ </li>
+ <li class="none">
+ <strong>Using Custom Checkstyle Property Expansion Definitions</strong>
+ </li>
+ <li class="none">
+ <a href="../examples/suppressions-filter.html">Using a Suppressions Filter</a>
+ </li>
+ <li class="none">
+ <a href="../examples/custom-developed-checkstyle.html">Using Custom Developed Checkstyle Checks</a>
+ </li>
+ <li class="none">
+ <a href="../examples/multi-module-config.html">Multimodule Configuration</a>
+ </li>
+ </ul>
+ <h5>Project Documentation</h5>
+ <ul>
+ <li class="collapsed">
+ <a href="../project-info.html">Project Information</a>
+ </li>
+ <li class="collapsed">
+ <a href="../project-reports.html">Project Reports</a>
+ </li>
+ </ul>
+ <h5>Maven Projects</h5>
+ <ul>
+ <li class="none">
+ <a href="../../../ant-tasks/index.html">Ant Tasks</a>
+ </li>
+ <li class="none">
+ <a href="../../../archetype/index.html">Archetype</a>
+ </li>
+ <li class="none">
+ <a href="../../../doxia/index.html">Doxia</a>
+ </li>
+ <li class="none">
+ <a href="../../../jxr/index.html">JXR</a>
+ </li>
+ <li class="none">
+ <a href="../../../ref/current">Maven</a>
+ </li>
+ <li class="none">
+ <a href="../../../pom/index.html">Parent POMs</a>
+ </li>
+ <li class="none">
+ <a href="../../index.html">Plugins</a>
+ </li>
+ <li class="none">
+ <a href="../../../plugin-testing/index.html">Plugin Testing</a>
+ </li>
+ <li class="none">
+ <a href="../../../plugin-tools/index.html">Plugin Tools</a>
+ </li>
+ <li class="none">
+ <a href="../../../apache-resource-bundles/index.html">Resource Bundles</a>
+ </li>
+ <li class="none">
+ <a href="../../../scm/index.html">SCM</a>
+ </li>
+ <li class="none">
+ <a href="../../../shared/index.html">Shared Components</a>
+ </li>
+ <li class="none">
+ <a href="../../../skins/index.html">Skins</a>
+ </li>
+ <li class="none">
+ <a href="../../../surefire/index.html">Surefire</a>
+ </li>
+ <li class="none">
+ <a href="../../../wagon/index.html">Wagon</a>
+ </li>
+ </ul>
+ <h5>ASF</h5>
+ <ul>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/how-it-works.html" class="externalLink">How Apache Works</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/" class="externalLink">Foundation</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsoring Apache</a>
+ </li>
+ <li class="none">
+ <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks</a>
+ </li>
+ </ul>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+ <img alt="Built by Maven" src="../images/logos/maven-feather.png"/>
+ </a>
+
+ </div>
+ </div>
+ <div id="bodyColumn">
+ <div id="contentBox">
+ <!-- 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 --><div class="section">
+<h2><a name="Using_Custom_Checkstyle_Property_Expansion_Definitions"></a>Using Custom Checkstyle Property Expansion Definitions</h2>
+<p>Custom <a class="externalLink" href="http://checkstyle.sourceforge.net/config.html#Properties">property expansion definitions</a> for the Checker can be defined.</p>
+<p>Checkstyle uses the property expansion mechanism to allow injection of specific values into a pre-defined Checker configuration. Using property expansion alone is an insufficient means to customize the checks performed by Checkstyle.</p>
+<p>Example: <tt>checkstyle.xml</tt> - only checks the package name in use to ensure that it conforms to the desired scheme, but allows for users of this Checker to specify their own projectname.</p>
+<div class="source">
+<pre><?xml version="1.0" ?>
+
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<module name="Checker">
+ <module name="TreeWalker">
+ <module name="PackageName">
+ <property name="format"
+ value="com\.example\.$\{projectname\}(\.[a-z][a-zA-Z0-9]+)*$"/>
+ </module>
+ </module>
+</module>
+</pre></div>
+<p>Example: <tt>pom.xml</tt> - Specifies the <tt>projectname</tt> property expansion that Checkstyle will use when encountering such a variable in the above Checker configuration.</p>
+<div class="source">
+<pre><project>
+ ...
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.16-SNAPSHOT</version>
+ <configuration>
+ <configLocation>checkstyle.xml</configLocation>
+ <propertyExpansion>projectname=whizbang</propertyExpansion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ ...
+</project>
+</pre></div>
+<p>The property expansion information can also come from a location using the <tt>propertiesLocation</tt> parameter as shown below. The <tt>propertiesLocation</tt> can point to a URL, File or build classpath resource reference.</p>
+<div class="source">
+<pre><project>
+ ...
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.16-SNAPSHOT</version>
+ <configuration>
+ <configLocation>checkstyle.xml</configLocation>
+ <propertesLocation>${basedir}/checkstyle.properties</propertiesLocation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ ...
+</project>
+</pre></div></div>
+ </div>
+ </div>
+ <div class="clear">
+ <hr/>
+ </div>
+ <div id="footer">
+ <div class="xright">
+ © 2005-2015
+ The Apache Software Foundation
+
+ - <a href="http://maven.apache.org/privacy-policy.html">Privacy Policy</a>.
+ Apache Maven, Maven, Apache, the Apache feather logo, and the Apache Maven project logos are trademarks of The Apache Software Foundation.
+ </div>
+ <div class="clear">
+ <hr/>
+ </div>
+ </div>
+ </body>
</html>
\ No newline at end of file
Modified: websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/inline-checker-config.html
==============================================================================
--- websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/inline-checker-config.html (original)
+++ websites/production/maven/components/plugins-archives/maven-checkstyle-plugin-LATEST/examples/inline-checker-config.html Sat May 2 10:15:09 2015
@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
- | Generated by Apache Maven Doxia at 2015-04-11
+ | Generated by Apache Maven Doxia at 2015-05-02
| Rendered using Apache Maven Stylus Skin 1.5
-->
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -13,7 +13,7 @@
</style>
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
<meta name="author" content="2014-02-14" />
- <meta name="Date-Revision-yyyymmdd" content="20150411" />
+ <meta name="Date-Revision-yyyymmdd" content="20150502" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
@@ -47,7 +47,7 @@
Using an 'inlined' Checkstyle Checker Configuration
</div>
<div class="xright">
- Last Published: 2015-04-11
+ Last Published: 2015-05-02
| Version: 2.16-SNAPSHOT
</div>
<div class="clear">
@@ -107,10 +107,10 @@
</ul>
<h5>Project Documentation</h5>
<ul>
- <li class="collapsed">
+ <li class="collapsed">
<a href="../project-info.html">Project Information</a>
</li>
- <li class="collapsed">
+ <li class="collapsed">
<a href="../project-reports.html">Project Reports</a>
</li>
</ul>
@@ -237,7 +237,8 @@
</plugins>
</build>
...
-</project></pre></div></div>
+</project>
+</pre></div></div>
</div>
</div>
<div class="clear">