Author: jdcasey
Date: Wed Nov 30 12:03:48 2005
New Revision: 350034

URL: http://svn.apache.org/viewcvs?rev=350034&view=rev
Log:
PR: MNG-1113
Submitted By: Joakim Erdfelt
Reviewed By: John Casey

Applied, with changes. This patch did a good job of consolidating access to 
checkstyle configuration files behind a Locator class, which checked URLs, 
Files, and classpath resources. However, it also removed a lot of existing mojo 
parameters, which could have left many users high and dry. I've put the missing 
parameters back in, and deprecated them. Also, the report merges the deprecated 
parameters in with the new ones (new-parameter values win here) before 
proceeding. This report plugin now seems to be fully configurable for 
Checkstyle 3.4.

We'll need to revisit with some new functionality to get it up to snuff for 
Checkstyle 4.0...this will have to wait for another release.

Added:
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/Locator.java
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt
   (with props)
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml
   (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/customize.apt   
(with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/tips.apt   (with 
props)
Modified:
    maven/plugins/trunk/maven-checkstyle-plugin/pom.xml
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/howto.apt
    
maven/plugins/trunk/maven-checkstyle-plugin/src/site/resources/sample-checkstyle.html
    maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml

Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/pom.xml?rev=350034&r1=350033&r2=350034&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/pom.xml Wed Nov 30 12:03:48 2005
@@ -1,4 +1,5 @@
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
   <parent>
     <artifactId>maven-plugin-parent</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
@@ -22,12 +23,29 @@
       <timezone>-5</timezone>
     </developer>
   </developers>
+  <contributors>
+    <contributor>
+      <name>Joakim Erdfelt</name>
+      <email>[EMAIL PROTECTED]</email>
+    </contributor>
+  </contributors>
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-impl</artifactId>
       <version>2.0</version>
     </dependency>
+    <!-- Eventually, use the shared libs to keep it consistent with other 
plugins... -->
+    <!-- dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-shared-io</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-shared-monitor</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency -->
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=350034&r1=350033&r2=350034&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
 Wed Nov 30 12:03:48 2005
@@ -34,6 +34,7 @@
 import org.apache.maven.reporting.MavenReportException;
 import org.codehaus.doxia.site.renderer.SiteRenderer;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringInputStream;
 import org.codehaus.plexus.util.StringOutputStream;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -44,23 +45,43 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.MissingResourceException;
 import java.util.Properties;
 import java.util.ResourceBundle;
 
 /**
+ * TODO: add report generation for ruleset/configuration. 
+ * 
  * @author <a href="mailto:[EMAIL PROTECTED]">Emmanuel Venisse</a>
  * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Siveton</a>
- * @version $Id: DependenciesReport.java,v 1.2 2005/02/23 00:08:02 brett Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Joakim Erdfelt</a>
  * @goal checkstyle
  */
 public class CheckstyleReport
     extends AbstractMavenReport
 {
     /**
+     * @deprecated Remove with format parameter.
+     */
+    private static final Map FORMAT_TO_CONFIG_LOCATION;
+    
+    static
+    {
+        Map fmt2Cfg = new HashMap();
+        
+        fmt2Cfg.put( "sun", "config/sun_checks.xml" );
+        fmt2Cfg.put( "turbine", "config/turbine_checks.xml" );
+        fmt2Cfg.put( "avalon", "config/avalon_checks.xml" );
+        fmt2Cfg.put( "maven", "config/maven_checks.xml" );
+        
+        FORMAT_TO_CONFIG_LOCATION = Collections.unmodifiableMap( fmt2Cfg );
+    }
+    
+    /**
      * Specifies the directory where the report will be generated
      *
      * @parameter default-value="${project.reporting.outputDirectory}"
@@ -84,18 +105,81 @@
     private String excludes;
 
     /**
+     * <p>
+     * Specifies the location of the XML configuration to use.
+     * </p>
+     * 
+     * <p>
+     * Potential values are a filesystem path, a URL, or a classpath
+     * resource.  This parameter expects that the contents of the location
+     * conform to the xml format (Checkstyle 
+     * <a href="http://checkstyle.sourceforge.net/config.html#Modules";>Checker 
+     * module</a>) configuration of rulesets.
+     * </p>
+     * 
+     * <p>
+     * This parameter is resolved as resource, URL, then file.  
+     * If resolved to a resource, or a URL, the contents of the configuration
+     * is copied into the 
+     * <code>${project.build.directory}/checkstyle-configuration.xml</code>
+     * file before being passed to checkstyle as a configuration.
+     * </p>
+     * 
+     * <p>
+     * There are 4 predefined rulesets.
+     * </p>
+     * 
+     * <ul>
+     * <li><code>config/sun_checks.xml</code>: Sun Checks.</li>
+     * <li><code>config/turbine_checks.xml</code>: Turbine Checks.</li>
+     * <li><code>config/avalon_checks.xml</code>: Avalon Checks.</li>
+     * <li><code>config/maven_checks.xml</code>: Maven Source Checks.</li>
+     * </ul>
+     * 
+     * @parameter default-value="config/sun_checks.xml"
+     */
+    private String configLocation;
+    
+    /**
      * Specifies what predefined check set to use. Available sets are
      * "sun" (for the Sun coding conventions), "turbine", and "avalon".
      * Default is sun.
      *
      * @parameter default-value="sun"
+     * @deprecated Use configLocation instead.
      */
     private String format;
 
     /**
+     * <p>
+     * Specifies the location of the properties file.
+     * </p>
+     * 
+     * <p>
+     * This parameter is resolved as URL, File, then resource.  
+     * If successfully resolved, the contents of the properties location is 
+     * copied into the 
+     * <code>${project.build.directory}/checkstyle-checker.properties</code>
+     * file before being passed to checkstyle for loading.
+     * </p>
+     * 
+     * <p>
+     * The contents of the <code>propertiesLocation</code> will be made 
+     * available to checkstyle for specifying values for parameters within 
+     * the xml configuration (specified in the <code>configLocation</code> 
+     * parameter).
+     * </p> 
+     * 
+     * @parameter 
+     * @since 2.0-beta-2
+     */
+    private String propertiesLocation;
+    
+    /**
      * Specifies the location of the checkstyle properties that will be used 
to check the source.
      *
      * @parameter
+     * @deprecated Use propertiesLocation instead.
      */
     private File propertiesFile;
 
@@ -103,21 +187,51 @@
      * Specifies the URL of the checkstyle properties that will be used to 
check the source.
      *
      * @parameter
+     * @deprecated Use propertiesLocation instead.
      */
     private URL propertiesURL;
 
     /**
+     * Allows for specifying raw property expansion information.
+     * 
+     * @parameter
+     */
+    private String propertyExpansion;
+
+    /**
+     * Specifies the location of the License file (a.k.a. the header file) 
+     * that is used by Checkstyle to verify that source code has the 
+     * correct copyright.
+     *
+     * @parameter default-value="LICENSE.txt"
+     * @since 2.0-beta-2
+     */
+    private String headerLocation;
+
+    /**
      * Specifies the location of the License file (a.k.a. the header file) 
that is used by Checkstyle
      * to verify that source code has the correct copyright.
      *
      * @parameter expression="${basedir}/LICENSE.txt"
+     * @deprecated Use headerLocation instead.
      */
     private File headerFile;
+    
+    /**
+     * Specifies the DEFAULT location of the License file (a.k.a. the header 
file) in order to check whether
+     * the headerFile parameter is defaulted.
+     *
+     * @parameter expression="${basedir}/LICENSE.txt"
+     * @readonly
+     * @required
+     * @deprecated Remove with headerFile.
+     */
+    private File defaultHeaderFile;
 
     /**
      * Specifies the cache file used to speed up Checkstyle on successive runs.
      *
-     * @parameter expression="${project.build.directory}/checkstyle-cachefile"
+     * @parameter 
default-value="${project.build.directory}/checkstyle-cachefile"
      */
     private String cacheFile;
 
@@ -130,12 +244,31 @@
     private File useFile;
 
     /**
+     * <p>
+     * Specifies the location of the suppressions XML file to use.
+     * </p>
+     * 
+     * <p>
+     * This parameter is resolved as resource, URL, then file.  
+     * If resolved to a resource, or a URL, the contents of the suppressions
+     * XML is copied into the 
+     * <code>${project.build.directory}/checkstyle-supressions.xml</code>
+     * file before being passed to checkstyle for loading.
+     * </p>
+     *
+     * @parameter
+     * @since 2.0-beta-2
+     */
+    private String suppressionsLocation;
+
+    /**
      * Specifies the location of the supperssions XML file to use. The plugin 
defines a Checkstyle
      * property named <code>checkstyle.suppressions.file</code> with the value 
of this
      * property. This allows using the Checkstyle property your own custom 
checkstyle
      * configuration file when specifying a suppressions file.
      *
      * @parameter
+     * @deprecated Use suppressionsLocation instead.
      */
     private String suppressionsFile;
 
@@ -143,7 +276,7 @@
      * Specifies the path and filename to save the checkstyle output.  The 
format of the output file is
      * determined by the <code>outputFileFormat</code>
      *
-     * @parameter expression="${project.build.directory}/checkstyle-result.txt"
+     * @parameter 
default-value="${project.build.directory}/checkstyle-result.txt"
      */
     private String outputFile;
 
@@ -156,9 +289,29 @@
     private String outputFileFormat;
 
     /**
+     * <p>
+     * Specifies the location of the package names XML to be used to configure 
+     * the Checkstyle <a 
href="http://checkstyle.sourceforge.net/config.html#Packages";>Packages</a>.
+     * </p>
+     * 
+     * <p>
+     * This parameter is resolved as resource, URL, then file.  
+     * If resolved to a resource, or a URL, the contents of the package names
+     * XML is copied into the 
+     * <code>${project.build.directory}/checkstyle-packagenames.xml</code>
+     * file before being passed to checkstyle for loading.
+     * </p>
+     *
+     * @parameter
+     * @since 2.0-beta-2
+     */
+    private String packageNamesLocation;
+
+    /**
      * Specifies the location of the package names XML to be used to configure 
Checkstyle
      *
      * @parameter
+     * @deprecated Use packageNamesLocation instead.
      */
     private String packageNamesFile;
 
@@ -172,20 +325,20 @@
     /**
      * Specifies the location of the source files to be used for Checkstyle
      *
-     * @parameter expression="${project.build.sourceDirectory}"
+     * @parameter default-value="${project.build.sourceDirectory}"
      * @required
      */
     private File sourceDirectory;
 
     /**
-     * @parameter expression="${project}"
+     * @parameter default-value="${project}"
      * @required
      * @readonly
      */
     private MavenProject project;
 
     /**
-     * @parameter 
expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
+     * @component
      * @required
      * @readonly
      */
@@ -194,13 +347,14 @@
     private static final File[] EMPTY_FILE_ARRAY = new File[0];
 
     private StringOutputStream stringOutputStream;
+    private Locator locator;
 
     /**
      * @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale)
      */
     public String getName( Locale locale )
     {
-        return getBundleWithDefaultLocale( locale ).getString( 
"report.checkstyle.name" );
+        return getBundle( locale ).getString( "report.checkstyle.name" );
     }
 
     /**
@@ -208,7 +362,7 @@
      */
     public String getDescription( Locale locale )
     {
-        return getBundleWithDefaultLocale( locale ).getString( 
"report.checkstyle.description" );
+        return getBundle( locale ).getString( "report.checkstyle.description" 
);
     }
 
     /**
@@ -241,37 +395,64 @@
     public void executeReport( Locale locale )
         throws MavenReportException
     {
+        mergeDeprecatedInfo();
+        
         if ( !canGenerateReport() )
         {
             // TODO: failure if not a report
             throw new MavenReportException( "No source directory to process 
for checkstyle" );
         }
+        
+//        for when we start using maven-shared-io and maven-shared-monitor...
+//        locator = new Locator( new MojoLogMonitorAdaptor( getLog() ) );
+        
+        locator = new Locator( getLog() );
 
         Map files = executeCheckstyle();
 
-        CheckstyleReportGenerator generator = new CheckstyleReportGenerator( 
getSink(), getBundleWithDefaultLocale( locale ) );
+        CheckstyleReportGenerator generator = new CheckstyleReportGenerator( 
getSink(), getBundle( locale ) );
 
         generator.generateReport( files );
     }
 
-    private ResourceBundle getBundleWithDefaultLocale( Locale locale )
+    /**
+     * Merge in the deprecated parameters to the new ones, unless the new 
parameters have values.
+     * 
+     * @deprecated Remove when deprecated params are removed.
+     */
+    private void mergeDeprecatedInfo()
     {
-        ResourceBundle bundle;
-        try
+        if ( "config/sun_checks.xml".equals( configLocation ) && 
!"sun".equals( format ) )
         {
-            bundle = getBundle( locale );
+            configLocation = (String) FORMAT_TO_CONFIG_LOCATION.get( format );
         }
-        catch ( MissingResourceException e )
+        
+        if ( StringUtils.isEmpty( propertiesLocation ) )
         {
-            Locale defaultLocale = Locale.ENGLISH;
-            
-            getLog().warn( "Cannot find checkstyle message bundle for locale: 
" + locale.getDisplayName() + ". Using default: " + 
defaultLocale.getDisplayName() + " instead." );
-            getLog().debug( "Error locating message bundle.", e );
-            
-            bundle = getBundle( defaultLocale );
+            if ( propertiesFile != null )
+            {
+                propertiesLocation = propertiesFile.getPath();
+            }
+            else if ( propertiesURL != null )
+            {
+                propertiesLocation = propertiesURL.toExternalForm();
+            }
+        }
+        
+        if ( "LICENSE.txt".equals( headerLocation ) && 
!defaultHeaderFile.equals( headerFile ) )
+        {
+            headerLocation = headerFile.getPath();
         }
         
-        return bundle;
+        if ( StringUtils.isEmpty( suppressionsLocation ) )
+        {
+            suppressionsLocation = suppressionsFile;
+        }
+        
+        if ( StringUtils.isEmpty( packageNamesLocation ) )
+        {
+            packageNamesLocation = packageNamesFile;
+        }
     }
 
     private Map executeCheckstyle()
@@ -288,7 +469,7 @@
         }
 
         String configFile = getConfigFile();
-
+        
         Properties overridingProperties = getOverridingProperties();
 
         Checker checker;
@@ -353,7 +534,7 @@
         return sinkListener.getFiles();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.maven.reporting.MavenReport#getOutputName()
      */
     public String getOutputName()
@@ -438,6 +619,10 @@
 
         return (File[]) files.toArray( EMPTY_FILE_ARRAY );
     }
+    
+    private String getLocationTemp(String name) {
+        return project.getBuild().getDirectory() + File.separator + name;
+    }
 
     private Properties getOverridingProperties()
         throws MavenReportException
@@ -446,25 +631,34 @@
 
         try
         {
+            File propertiesFile = locator.resolveLocation( propertiesLocation,
+                                                           getLocationTemp( 
"checkstyle-checker.properties" ) );
+            
             if ( propertiesFile != null )
             {
-                if ( propertiesFile.exists() )
-                {
-                    p.load( new FileInputStream( propertiesFile ) );
-                }
-                else
-                {
-                    getLog().warn( "File '" + propertiesFile + "' not found - 
skipping" );
-                }
+                p.load( new FileInputStream( propertiesFile ) );
             }
-            else if ( propertiesURL != null )
+            
+            if ( StringUtils.isNotEmpty( propertyExpansion ) )
             {
-                p.load( propertiesURL.openStream() );
+                p.load( new StringInputStream( propertyExpansion ) );
             }
 
-            if ( headerFile != null )
+            if ( StringUtils.isNotEmpty( headerLocation ) )
             {
-                p.setProperty( "checkstyle.header.file", 
headerFile.getAbsolutePath() );
+                try
+                {
+                    File headerFile = locator.resolveLocation( headerLocation,
+                                                               
getLocationTemp( "checkstyle-header.txt" ) );
+                    if ( headerFile != null )
+                    {
+                        p.setProperty( "checkstyle.header.file", 
headerFile.getAbsolutePath() );
+                    }
+                }
+                catch ( IOException e )
+                {
+                    throw new MavenReportException( "Unable to process header 
location.", e );
+                }
             }
 
             if ( cacheFile != null )
@@ -479,60 +673,70 @@
 
         return p;
     }
-
+    
     private String getConfigFile()
         throws MavenReportException
     {
-        URL configFile;
-
-        if ( StringUtils.isEmpty( format ) || "sun".equalsIgnoreCase( 
format.trim() ) )
-        {
-            // By default
-            configFile = getClass().getResource( "/config/sun_checks.xml" );
-        }
-        else if ( "turbine".equalsIgnoreCase( format.trim() ) )
-        {
-            configFile = getClass().getResource( "/config/turbine_checks.xml" 
);
-        }
-        else if ( "avalon".equalsIgnoreCase( format.trim() ) )
+        try
         {
-            configFile = getClass().getResource( "/config/avalon_checks.xml" );
+            File configFile = locator.resolveLocation( configLocation, 
getLocationTemp( "checkstyle-checker.xml" ) );
+            if ( configFile == null )
+            {
+                throw new MavenReportException( "Unable to process null config 
location." );
+            }
+            return configFile.getAbsolutePath();
         }
-        else
+        catch ( IOException e )
         {
-            // TODO: failure if not a report
-            throw new MavenReportException( "Invalid configuration file 
format: " + format );
+            throw new MavenReportException( "Unable to find configuration file 
location.", e );
         }
 
-        return configFile.toString();
     }
 
     private ModuleFactory getModuleFactory()
         throws CheckstyleException
     {
-        if ( StringUtils.isEmpty( packageNamesFile ) )
+        try
+        {
+            File packageNamesFile = locator.resolveLocation( 
packageNamesLocation,
+                                                             getLocationTemp( 
"checkstyle-packages.xml" ) );
+
+            if ( packageNamesFile == null )
+            {
+                return null;
+            }
+
+            return PackageNamesLoader.loadModuleFactory( 
packageNamesFile.getAbsolutePath() );
+        }
+        catch ( IOException e )
         {
+            getLog().error( "Unable to process package names location: " + 
packageNamesLocation, e );
             return null;
         }
-
-        return PackageNamesLoader.loadModuleFactory( packageNamesFile );
     }
 
     private FilterSet getSuppressions()
         throws MavenReportException
     {
-        if ( StringUtils.isEmpty( suppressionsFile ) )
-        {
-            return null;
-        }
-
         try
         {
-            return SuppressionsLoader.loadSuppressions( suppressionsFile );
+            File suppressionsFile = locator.resolveLocation( 
suppressionsLocation,
+                                                             getLocationTemp( 
"checkstyle-suppressions.xml" ) );
+
+            if ( suppressionsFile == null )
+            {
+                return null;
+            }
+
+            return SuppressionsLoader.loadSuppressions( 
suppressionsFile.getAbsolutePath() );
         }
         catch ( CheckstyleException ce )
         {
-            throw new MavenReportException( "failed to load suppressions XML: 
" + suppressionsFile, ce );
+            throw new MavenReportException( "failed to load suppressions 
location: " + suppressionsLocation, ce );
+        }
+        catch ( IOException e )
+        {
+            throw new MavenReportException( "Failed to process supressions 
location: " + suppressionsLocation, e );
         }
     }
 

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/Locator.java
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/Locator.java?rev=350034&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/Locator.java
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/Locator.java
 Wed Nov 30 12:03:48 2005
@@ -0,0 +1,140 @@
+package org.apache.maven.plugin.checkstyle;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * Performs Locator services for the <code>*Location</code> parameters in the 
+ * Reports.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Joakim Erdfelt</a>
+ */
+public class Locator
+{
+    private Log log;
+
+    /**
+     * Create a Locator object.
+     * 
+     * @param logger the logger object to log with.
+     */
+    public Locator( Log log )
+    {
+        this.log = log;
+    }
+
+    /**
+     * Obtain a Log object.
+     * 
+     * @return the Log object.
+     */
+    private Log getLog()
+    {
+        if ( this.log == null )
+        {
+            this.log = new SystemStreamLog();
+        }
+        return this.log;
+    }
+
+    /**
+     * <p>
+     * Attempts to resolve a location parameter into a real file.
+     * </p>
+     * 
+     * <p>
+     * Checks a location string to for a resource, URL, or File that matches.
+     * If a resource or URL is found, then a local file is created with that
+     * locations contents.
+     * </p>
+     * 
+     * @param location the location string to match against.
+     * @param localfile the local file to use in case of resource or URL.
+     * @return the File of the resolved location.
+     * @throws IOException if file is unable to be found or copied into 
<code>localfile</code> destination.
+     */
+    public File resolveLocation( String location, String localfile )
+        throws IOException
+    {
+        getLog().debug( "resolveLocation(" + location + ", " + localfile + ")" 
);
+        if ( StringUtils.isEmpty( location ) )
+        {
+            return null;
+        }
+
+        File retFile = new File( localfile );
+
+        // Attempt a URL
+        if ( location.indexOf( "://" ) > 1 )
+        {
+            // Found a URL
+            URL url = new URL( location );
+            getLog().debug( "Potential URL: " + url.toExternalForm() );
+            FileUtils.copyURLToFile( url, retFile );
+        }
+        else
+        {
+            getLog().debug( "Location is not a URL." );
+            // Attempt a File.
+            File fileLocation = new File( location );
+            if ( fileLocation.exists() )
+            {
+                // Found a File.
+                getLog().debug( "Potential File: " + 
fileLocation.getAbsolutePath() );
+                FileUtils.copyFile( fileLocation, retFile );
+            }
+            else
+            {
+                getLog().debug( "Location is not a File." );
+                // Attempt a Resource.
+                URL url = this.getClass().getClassLoader().getResource( 
location );
+                if ( url != null )
+                {
+                    // Found a Resource.
+                    getLog().debug( "Potential Resource: " + 
url.toExternalForm() );
+                    FileUtils.copyURLToFile( url, retFile );
+                }
+                else
+                {
+                    getLog().debug( "Location is not a Resource." );
+                    throw new IOException( "Unable to find location '" + 
location + "' as URL, File or Resource." );
+                }
+            }
+        }
+
+        if ( !retFile.exists() )
+        {
+            throw new FileNotFoundException( "Destination file does not 
exist." );
+        }
+
+        if ( retFile.length() <= 0 )
+        {
+            throw new IOException( "Destination file has no content." );
+        }
+
+        return retFile;
+    }
+}

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/Locator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/Locator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt?rev=350034&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt
 Wed Nov 30 12:03:48 2005
@@ -0,0 +1,18 @@
+^package 
+^$
+^/\*$
+^ \* Copyright \d\d\d\d-\d\d\d\d The Apache Software Foundation.$
+^ \*$
+^ \* Licensed under the Apache License, Version 2.0 (the "License");$
+^ \* you may not use this file except in compliance with the License.$
+^ \* You may obtain a copy of the License at$
+^ \*$
+^ \*      http://www.apache.org/licenses/LICENSE-2.0$
+^ \*$
+^ \* Unless required by applicable law or agreed to in writing, software$
+^ \* distributed under the License is distributed on an "AS IS" BASIS,
+^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+^ \* See the License for the specific language governing permissions and
+^ \* limitations under the License.
+^ \*/
+^$

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven-header.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml?rev=350034&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml
 (added)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml
 Wed Nov 30 12:03:48 2005
@@ -0,0 +1,172 @@
+<?xml version="1.0"?>
+<!-- 
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.1//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_1.dtd";>
+
+<!--
+  Checkstyle configuration that checks the maven coding conventions from:
+-->
+
+<module name="Checker">
+
+    <!-- Checks that a package.html file exists for each package.     -->
+    <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
+    <!-- module name="PackageHtml"/ -->
+
+    <!-- Checks whether files end with a new line.                        -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+    <!-- module name="NewlineAtEndOfFile"/ -->
+
+    <!-- Checks that property files contain the same keys.         -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+    <!-- module name="Translation"/ -->
+
+    <module name="TreeWalker">
+
+        <!-- property name="cacheFile" value="${checkstyle.cache.file}"/ -->
+
+        <property name="tabWidth" value="4"/>
+
+        <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"/>
+        </module>
+
+        <module name="MemberName" />
+
+        <!-- Checks for Javadoc comments.                     -->
+        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+        <module name="JavadocMethod"/>
+        <module name="JavadocType"/>
+        <module name="JavadocVariable"/>
+
+
+        <!-- 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 Headers                              -->
+        <!-- See http://checkstyle.sf.net/config_header.html -->
+        <module name="RegexpHeader">
+            <property name="header" value="^package \n^$\n/\*$\n^ \* Copyright 
\d\d\d\d-\d\d\d\d The Apache Software Foundation.$\n^ \*$\n^ \* Licensed under 
the Apache License, Version 2.0 \(the &quot;License&quot;\)\;$\n^ \* you may 
not use this file except in compliance with the License.$\n^ \* You may obtain 
a copy of the License at$\n^ \*$\n^ \*      
http://www.apache.org/licenses/LICENSE-2.0$\n^ \*$\n^ \* Unless required by 
applicable law or agreed to in writing, software$\n^ \* distributed under the 
License is distributed on an &quot;AS IS&quot; BASIS,$\n^ \* WITHOUT WARRANTIES 
OR CONDITIONS OF ANY KIND, either express or implied.$\n^ \* See the License 
for the specific language governing permissions and$\n^ \* limitations under 
the License.$\n^ \*/$\n^$"/>
+        </module>
+
+        <!-- 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="FileLength"/>
+        <module name="MethodLength"/>
+        <module name="ParameterNumber"/>
+
+
+        <!-- Checks for whitespace                               -->
+        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+        <module name="EmptyForIteratorPad"/>
+        <!-- module name="NoWhitespaceAfter"/ -->
+        <!-- module name="NoWhitespaceBefore"/ -->
+        <module name="OperatorWrap"/>
+        <module name="ParenPad">
+          <property name="option" value="space" />
+        </module>
+        <module name="TabCharacter"/>
+        <module name="WhitespaceAfter"/>
+        <module name="WhitespaceAround"/>
+        <!-- module name="MethodParamPad"/ -->
+
+
+        <!-- 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"/>
+        <module name="NeedBraces"/>
+
+
+        <!-- Checks for common coding problems               -->
+        <!-- See http://checkstyle.sf.net/config_coding.html -->
+        <module name="AvoidInlineConditionals"/>
+        <module name="DoubleCheckedLocking"/>
+        <module name="EmptyStatement"/>
+        <module name="EqualsHashCode"/>
+        <module name="HiddenField"/>
+        <module name="IllegalInstantiation"/>
+        <module name="InnerAssignment"/>
+        <module name="MagicNumber"/>
+        <module name="MissingSwitchDefault"/>
+        <module name="RedundantThrows"/>
+        <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"/>
+
+
+        <!-- Miscellaneous other checks.                   -->
+        <!-- See http://checkstyle.sf.net/config_misc.html -->
+        <!-- module name="ArrayTypeStyle"/ -->
+        <!-- module name="FinalParameters"/ -->
+        <!-- Line with Trailing Spaces (disabled as it's to noisy)
+        <module name="GenericIllegalRegexp">
+            <property name="format" value="\s+$"/>
+            <property name="message" value="Line has trailing spaces."/>
+        </module>
+          -->
+        <!-- Let todo plugin handle this.
+        <module name="TodoComment"/>
+          -->
+        <module name="UpperEll"/>
+
+    </module>
+
+</module>

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/customize.apt
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/customize.apt?rev=350034&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/customize.apt 
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/customize.apt Wed 
Nov 30 12:03:48 2005
@@ -0,0 +1,213 @@
+ ------
+ Customizing the Maven 2 Checkstyle Plugin
+ ------
+
+Customizing the Maven 2 Checkstyle Plugin
+
+* Use a custom Checkstyle checker configuration.
+
+  A custom {{{http://checkstyle.sourceforge.net/config.html#Checker}Checker 
configuration xml file}} can be defined and then referenced via a URL, File, or 
build classpath resource reference.
+
+  To reference the a custom Checkstyle Checker configuration, use the 
<<configLocation>> parameter.
+
+-------------------
+  <project>
+      ...
+      <reporting>
+          <plugins>
+              <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-checkstyle-plugin</artifactId>
+                  <configuration>
+                      <configLocation>checkstyle.xml</configLocation>
+                  </configuration>
+              </plugin>
+          </plugins>
+      </reporting>
+      ...
+  </project>
+-------------------
+
+  This example causes the Maven 2 Checkstyle plugin to check for a File named 
<<checkstyle.xml>> or a resource named <<checkstyle.xml>> within the compile 
scope of the dependencies or build extensions classpath.
+
+  There are 4 predefined Checkstyle configuration definitions that ship with 
the Maven 2 Checkstyle Plugin, the Sun Microsystems Definition is selected by 
default.
+
+  * <<config/sun_checks.xml>> - Sun Microsystems Definition (default).
+
+  * <<config/maven_checks.xml>> - Maven Development Definitions.
+
+  * <<config/turbine_checks.xml>> - Turbine Development Definitions.
+
+  * <<config/avalon_checks.xml>> - Avalon Development Definitions.
+
+
+
+* Use custom Checkstyle property expansion definitions.
+
+  A custom 
{{{http://checkstyle.sourceforge.net/config.html#Properties}property expansion 
definitions}} for the Checker can be defined.
+
+  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.
+
+  Example: <<checkstyle.xml>> - 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.
+
+-------------------
+<?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>
+-------------------
+
+  Example: <<pom.xml>> - Specifies the <<projectname>> property expansion that 
Checkstyle will use when encountering such a variable in the above Checker 
configuration.
+
+-------------------
+  <project>
+      ...
+      <reporting>
+          <plugins>
+              <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-checkstyle-plugin</artifactId>
+                  <configuration>
+                      <configLocation>checkstyle.xml</configLocation>
+                      <propertyExpansion>
+                        projectname=whizbang
+                      </propertyExpansion>
+                  </configuration>
+              </plugin>
+          </plugins>
+      </reporting>
+      ...
+  </project>
+-------------------
+
+  The property expansion information can also come from a location using the 
<<propertiesLocation>> parameter, which can point to a URL, File, or build 
classpath resource reference.
+
+* Using a Suppressions filter.
+
+  Checkstyle allows the definition of a list of files and their line ranges 
that should be suppressed from reporting any violations (known as a 
{{{http://checkstyle.sourceforge.net/config.html#Filters}supressions filter}} ).
+
+  Example: <<checkstyle-suppressions.xml>>
+
+-------------------
+<?xml version="1.0"?>
+
+<!DOCTYPE suppressions PUBLIC
+    "-//Puppy Crawl//DTD Suppressions 1.0//EN"
+    "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd";>
+
+<suppressions>
+    <suppress checks="JavadocStyleCheck"
+              files="GeneratedObject.java"
+              lines="50-9999"/>
+    <suppress checks="MagicNumberCheck"
+              files="LegacyDatasetConvertor.java"
+              lines="221,250-295"/>
+</suppressions>
+-------------------
+
+  Example: <<pom.xml>> - Specifies the suppressions filter that Checkstyle 
should use.
+
+-------------------
+  <project>
+      ...
+      <reporting>
+          <plugins>
+              <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-checkstyle-plugin</artifactId>
+                  <configuration>
+                      <configLocation>checkstyle.xml</configLocation>
+                      
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
+                  </configuration>
+              </plugin>
+          </plugins>
+      </reporting>
+      ...
+  </project>
+-------------------
+
+* Use a custom developed Checkstyle Check modules.
+
+  For the really adventurous, custom Checkstyle checks can be used with the 
Maven 2 Checkstyle Plugin.
+
+  The plugin provides the ability to define the 
{{{http://checkstyle.sourceforge.net/config.html#Packages}package names 
definition}} required to reference your custom check modules.
+
+  TIP: Create a maven project that produces a jar file of your custom checks, 
and then include it in your projects using the maven build extension in the 
pom.xml to avoid them being included in the compile or package phases of your 
project.
+
+  Example: <<mycompany-checkstyle-checks-1.0.jar>>.
+
+-------------------
+$ jar -tvf mycompany-checkstyle-checks-1.0.jar
+     0 Tue Nov 29 13:13:14 EST 2005 META-INF/
+   401 Tue Nov 29 13:13:12 EST 2005 META-INF/MANIFEST.MF
+     0 Tue Nov 29 13:13:12 EST 2005 META-INF/maven/
+     0 Tue Nov 29 13:13:14 EST 2005 META-INF/maven/com.mycompany/
+     0 Tue Nov 29 13:13:14 EST 2005 
META-INF/maven/com.mycompany/mycompany-checkstyle-checks/
+  8489 Tue Nov 29 13:13:14 EST 2005 
META-INF/maven/com.mycompany/mycompany-checkstyle-checks/pom.xml
+   151 Tue Nov 29 13:13:14 EST 2005 
META-INF/maven/com.mycompany/mycompany-checkstyle-checks/pom.properties
+     0 Tue Nov 29 13:13:14 EST 2005 com/
+     0 Tue Nov 29 13:13:14 EST 2005 com/mycompany/
+     0 Tue Nov 29 13:13:14 EST 2005 com/mycompany/checkstyle/
+  1252 Tue Nov 29 13:13:14 EST 2005 com/mycompany/checkstyle/packagenames.xml
+ 12939 Tue Nov 29 13:13:14 EST 2005 com/mycompany/checkstyle/PurityCheck.class
+-------------------
+
+  Example: <<checkstyle.xml>>
+
+-------------------
+<?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="PurityTest"/>
+    </module>
+</module>
+-------------------
+
+
+  Example: <<pom.xml>>
+
+-------------------
+  <project>
+      ...
+      <reporting>
+          <plugins>
+              <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-checkstyle-plugin</artifactId>
+                  <configuration>
+                      <configLocation>checkstyle.xml</configLocation>
+                      
<packageNamesLocation>com/mycompany/checkstyle/packagenames.xml</packageNamesLocation>
+                  </configuration>
+              </plugin>
+          </plugins>
+      </reporting>
+      ...
+      <build>
+          <extensions>
+              <extension>
+                  <groupId>com.mycompany</groupId>
+                  <artifactId>mycompany-checkstyle-checks</artifactId>
+                  <version>1.0</version>
+              </extension>
+          </extensions>
+      </build>
+  </project>
+-------------------
+
+
+

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/customize.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/customize.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/howto.apt
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/howto.apt?rev=350034&r1=350033&r2=350034&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/howto.apt 
(original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/howto.apt Wed Nov 
30 12:03:48 2005
@@ -18,16 +18,16 @@
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-checkstyle-plugin</artifactId>
-                  <version>2.0-alpha-3-SNAPSHOT</version>
               </plugin>
           </plugins>
       </reporting>
       ...
   </project>
--------------------    
+-------------------
 
   Execute the site plugin to generate the report distribution.
 
 -------------------
-  m2 site:site
--------------------  
\ No newline at end of file
+  mvn site
+-------------------
+

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/tips.apt
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/tips.apt?rev=350034&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/tips.apt (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/tips.apt Wed Nov 
30 12:03:48 2005
@@ -0,0 +1,106 @@
+ ------
+ Tips for Maven 2 Checkstyle Plugin
+ ------
+
+Tips for Maven 2 Checkstyle Plugin
+
+* Multimodule Configuration.
+
+  Configuring the Checkstyle plugin for use within a large multimodule 
projects can be done, but will require a little setup.
+
+  Example will use a mysterious project called 'whizbang'.
+
+-------------------
+[whizbang]$ ls
+drwxr-xr-x+ 5      0 Nov  3 15:36 core/
+drwxr-xr-x+ 6      0 Nov 16 16:11 gui/
+drwxr-xr-x+ 6      0 Nov 29 13:13 jmx/
+-rw-r--r--  1   6153 Nov 29 13:08 pom.xml
+drwxr-xr-x+ 4      0 Nov  1 15:48 src/
+-------------------
+
+  First: setup a sub project to house your build tools.
+
+-------------------
+[whizbang]$ ls
+drwxr-xr-x+ 4      0 Nov 29 13:44 build-tools/
+drwxr-xr-x+ 5      0 Nov  3 15:36 core/
+drwxr-xr-x+ 6      0 Nov 16 16:11 gui/
+drwxr-xr-x+ 6      0 Nov 29 13:13 jmx/
+-rw-r--r--  1   6153 Nov 29 13:08 pom.xml
+drwxr-xr-x+ 4      0 Nov  1 15:48 src/
+-------------------
+
+  Next, include the resources you want in the build-tools jar file.
+
+-------------------
+[whizbang/build-tools]$ find . -type f
+./pom.xml
+./src/main/resources/whizbang/checkstyle.xml
+./src/main/resources/whizbang/pmd.xml
+./src/main/resources/whizbang/LICENSE.txt
+-------------------
+
+  TIP: put the resources into a subdirectory that you can ensure will be 
unique, and not conflict with anyone else.
+
+  Now, include the checkstyle configuration in the top level pom.xml
+
+-------------------
+[whizbang]$ cat pom.xml
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project
+  xmlns="http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>com.example.whizbang</groupId>
+  <artifactId>whizbang-parent</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+  <name>WhizBang Parent</name>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>com.example.whizbang</groupId>
+        <artifactId>build-tools</artifactId>
+        <version>1.0</version>
+      </extension>
+    </extensions>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <configLocation>whizbang/checkstyle.xml</configLocation>
+          <headerLocation>whizbang/LICENSE.txt</headerLocation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+
+  <modules>
+    <module>build-tools</module>
+    <module>core</module>
+    <module>jmx</module>
+    <module>gui</module>
+  </modules>
+</project>
+-------------------
+
+  Once you are done with that, ensure that you do not include the 
maven-checkstyle-plugin in your sub modules, as their definition and 
configuration, will override the top level parent pom's definition.
+
+  Lastly, kick off a build of the site.
+
+-------------------
+[whizbang]$ mvn site
+-------------------
+
+  Every sub project will use the same checkstyle setup and configuration.
+
+

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/tips.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/tips.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/site/resources/sample-checkstyle.html
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/site/resources/sample-checkstyle.html?rev=350034&r1=350033&r2=350034&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/site/resources/sample-checkstyle.html
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/site/resources/sample-checkstyle.html
 Wed Nov 30 12:03:48 2005
@@ -41,6 +41,14 @@
 
           <strong><a href="howto.html">Overview</a></strong>
       </li>
+
+    <li class="none">
+          <a href="customize.html">Customization</a>
+        </li>
+              
+    <li class="none">
+          <a href="tips.html">Tips</a>
+        </li>
                 
     <li class="none">
           <a href="checkstyle.html">Sample Checkstyle Report</a>

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml?rev=350034&r1=350033&r2=350034&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml Wed Nov 30 
12:03:48 2005
@@ -14,7 +14,9 @@
 
     <menu name="Checkstyle Quickstart">
       <item name="Overview" href="howto.html"/>
-         <item name="Sample Checkstyle Report" href="sample-checkstyle.html"/>
+      <item name="Customization" href="customize.html"/>
+      <item name="Tips" href="tips.html"/>
+      <item name="Sample Checkstyle Report" href="sample-checkstyle.html"/>
     </menu>
     ${reports}
   </body>


Reply via email to