maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r632882 [2/7] - in /maven/enforcer/trunk: ./ enforcer-api/ enforcer-api/src/custom-rule-sample/ enforcer-api/src/custom-rule-sample/src/ enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer/rule/ enforcer-api/src/main...
Date Sun, 02 Mar 2008 23:41:28 GMT
Modified: maven/enforcer/trunk/enforcer-rules/pom.xml
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/pom.xml?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/pom.xml (original)
+++ maven/enforcer/trunk/enforcer-rules/pom.xml Sun Mar  2 15:41:23 2008
@@ -1,106 +1,106 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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. 
- *
--->
-<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>
-	<parent>
-	    <groupId>org.apache.maven.enforcer</groupId>
-        <artifactId>enforcer</artifactId>
-		<version>1-SNAPSHOT</version>
-	</parent>
-	
-	<artifactId>enforcer-rules</artifactId>
-	<packaging>jar</packaging>
-	<version>1.0-SNAPSHOT</version>
-
-	<name>Enforcer Rules</name>
-	<description>This component contains the standard Enforcer Rules</description>
-	<build>
-		<plugins>
-
-			<plugin>
-				<groupId>org.codehaus.plexus</groupId>
-				<artifactId>plexus-maven-plugin</artifactId>
-				<executions>
-					<execution>
-						<goals>
-							<goal>descriptor</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
- <plugin>
-       <groupId>org.apache.maven.plugins</groupId>
-       <artifactId>maven-jar-plugin</artifactId>
-       <executions>
-         <execution>
-           <goals>
-             <goal>test-jar</goal>
-           </goals>
-         </execution>
-       </executions>
-     </plugin>
-		</plugins>
-	</build>
-                  <dependencies>
-			<dependency>
-			<groupId>org.apache.maven</groupId>
-			<artifactId>maven-artifact</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.maven</groupId>
-			<artifactId>maven-plugin-api</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.maven</groupId>
-			<artifactId>maven-project</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.maven</groupId>
-			<artifactId>maven-core</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.codehaus.plexus</groupId>
-			<artifactId>plexus-utils</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.maven.shared</groupId>
-			<artifactId>maven-plugin-testing-harness</artifactId>
-			<scope>test</scope>
-		</dependency>
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-        </dependency>
-       <dependency>
-            <groupId>org.apache.maven.enforcer</groupId>
-            <artifactId>enforcer-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.beanshell</groupId>
-            <artifactId>bsh</artifactId>
-	  <version>2.0b4</version>
-        </dependency>
-		<dependency>
-			<groupId>junit</groupId>
-	                    <artifactId>junit</artifactId>
-		</dependency>	
-	</dependencies>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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. 
+ *
+-->
+<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>
+	<parent>
+	    <groupId>org.apache.maven.enforcer</groupId>
+        <artifactId>enforcer</artifactId>
+		<version>1-SNAPSHOT</version>
+	</parent>
+	
+	<artifactId>enforcer-rules</artifactId>
+	<packaging>jar</packaging>
+	<version>1.0-SNAPSHOT</version>
+
+	<name>Enforcer Rules</name>
+	<description>This component contains the standard Enforcer Rules</description>
+	<build>
+		<plugins>
+
+			<plugin>
+				<groupId>org.codehaus.plexus</groupId>
+				<artifactId>plexus-maven-plugin</artifactId>
+				<executions>
+					<execution>
+						<goals>
+							<goal>descriptor</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+ <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-jar-plugin</artifactId>
+       <executions>
+         <execution>
+           <goals>
+             <goal>test-jar</goal>
+           </goals>
+         </execution>
+       </executions>
+     </plugin>
+		</plugins>
+	</build>
+                  <dependencies>
+			<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-artifact</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-project</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.plexus</groupId>
+			<artifactId>plexus-utils</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.shared</groupId>
+			<artifactId>maven-plugin-testing-harness</artifactId>
+			<scope>test</scope>
+		</dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+        </dependency>
+       <dependency>
+            <groupId>org.apache.maven.enforcer</groupId>
+            <artifactId>enforcer-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.beanshell</groupId>
+            <artifactId>bsh</artifactId>
+	  <version>2.0b4</version>
+        </dependency>
+		<dependency>
+			<groupId>junit</groupId>
+	                    <artifactId>junit</artifactId>
+		</dependency>	
+	</dependencies>
+</project>

Propchange: maven/enforcer/trunk/enforcer-rules/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java Sun Mar  2 15:41:23 2008
@@ -1,176 +1,176 @@
-package org.apache.maven.plugins.enforcer;
-
-/*
- * 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.
- */
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.enforcer.rule.api.EnforcerRule;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-
-/**
- * Abstract Rule for banning dependencies
- * 
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @version $Id$
- */
-public abstract class AbstractBanDependencies
-    extends AbstractStandardEnforcerRule
-{
-
-    /**
-     * Specify if transitive dependencies should be searched (default) or only look at direct dependencies
-     * 
-     * @parameter
-     */
-    public boolean searchTransitive = true;
-
-    /**
-     * Execute the rule.
-     */
-    public void execute( EnforcerRuleHelper helper )
-        throws EnforcerRuleException
-    {
-
-        // get the project
-        MavenProject project = null;
-        try
-        {
-            project = (MavenProject) helper.evaluate( "${project}" );
-        }
-        catch ( ExpressionEvaluationException eee )
-        {
-            throw new EnforcerRuleException( "Unable to retrieve the MavenProject: ", eee );
-        }
-
-        // get the correct list of dependencies
-        Set dependencies = null;
-        if ( searchTransitive )
-        {
-            dependencies = project.getArtifacts();
-        }
-        else
-        {
-            dependencies = project.getDependencyArtifacts();
-        }
-
-        // look for banned dependencies
-        Set foundExcludes = checkDependencies( dependencies, helper.getLog() );
-
-        // if any are found, fail the check but list all of
-        // them
-        if ( foundExcludes != null && !foundExcludes.isEmpty() )
-        {
-            StringBuffer buf = new StringBuffer();
-            if ( message != null )
-            {
-                buf.append( message + "\n" );
-            }
-            Iterator iter = foundExcludes.iterator();
-            while ( iter.hasNext() )
-            {
-                buf.append( "Found Banned Dependency: " + ( (Artifact) iter.next() ).getId() + "\n" );
-            }
-            message = buf.toString();
-
-            throw new EnforcerRuleException( message );
-        }
-
-    }
-
-    /**
-     * Checks the set of dependencies against the list of excludes
-     * 
-     * @param dependencies
-     * @return
-     * @throws EnforcerRuleException
-     */
-    abstract protected Set checkDependencies( Set dependencies, Log log )
-        throws EnforcerRuleException;
-
-    /**
-     * @return the message
-     */
-    public String getMessage()
-    {
-        return this.message;
-    }
-
-    /**
-     * @param theMessage the message to set
-     */
-    public void setMessage( String theMessage )
-    {
-        this.message = theMessage;
-    }
-
-    /**
-     * @return the searchTransitive
-     */
-    public boolean isSearchTransitive()
-    {
-        return this.searchTransitive;
-    }
-
-    /**
-     * @param theSearchTransitive the searchTransitive to set
-     */
-    public void setSearchTransitive( boolean theSearchTransitive )
-    {
-        this.searchTransitive = theSearchTransitive;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
-     */
-    public String getCacheId()
-    {
-        return "0";
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
-     */
-    public boolean isCacheable()
-    {
-        // dependencies change per project, therefore they must always be rerun.
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
-     */
-    public boolean isResultValid( EnforcerRule theCachedRule )
-    {
-        // dependencies change per project, therefore they must always be rerun.
-        return false;
-    }
-}
+package org.apache.maven.plugins.enforcer;
+
+/*
+ * 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.
+ */
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+
+/**
+ * Abstract Rule for banning dependencies
+ * 
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @version $Id$
+ */
+public abstract class AbstractBanDependencies
+    extends AbstractStandardEnforcerRule
+{
+
+    /**
+     * Specify if transitive dependencies should be searched (default) or only look at direct dependencies
+     * 
+     * @parameter
+     */
+    public boolean searchTransitive = true;
+
+    /**
+     * Execute the rule.
+     */
+    public void execute( EnforcerRuleHelper helper )
+        throws EnforcerRuleException
+    {
+
+        // get the project
+        MavenProject project = null;
+        try
+        {
+            project = (MavenProject) helper.evaluate( "${project}" );
+        }
+        catch ( ExpressionEvaluationException eee )
+        {
+            throw new EnforcerRuleException( "Unable to retrieve the MavenProject: ", eee );
+        }
+
+        // get the correct list of dependencies
+        Set dependencies = null;
+        if ( searchTransitive )
+        {
+            dependencies = project.getArtifacts();
+        }
+        else
+        {
+            dependencies = project.getDependencyArtifacts();
+        }
+
+        // look for banned dependencies
+        Set foundExcludes = checkDependencies( dependencies, helper.getLog() );
+
+        // if any are found, fail the check but list all of
+        // them
+        if ( foundExcludes != null && !foundExcludes.isEmpty() )
+        {
+            StringBuffer buf = new StringBuffer();
+            if ( message != null )
+            {
+                buf.append( message + "\n" );
+            }
+            Iterator iter = foundExcludes.iterator();
+            while ( iter.hasNext() )
+            {
+                buf.append( "Found Banned Dependency: " + ( (Artifact) iter.next() ).getId() + "\n" );
+            }
+            message = buf.toString();
+
+            throw new EnforcerRuleException( message );
+        }
+
+    }
+
+    /**
+     * Checks the set of dependencies against the list of excludes
+     * 
+     * @param dependencies
+     * @return
+     * @throws EnforcerRuleException
+     */
+    abstract protected Set checkDependencies( Set dependencies, Log log )
+        throws EnforcerRuleException;
+
+    /**
+     * @return the message
+     */
+    public String getMessage()
+    {
+        return this.message;
+    }
+
+    /**
+     * @param theMessage the message to set
+     */
+    public void setMessage( String theMessage )
+    {
+        this.message = theMessage;
+    }
+
+    /**
+     * @return the searchTransitive
+     */
+    public boolean isSearchTransitive()
+    {
+        return this.searchTransitive;
+    }
+
+    /**
+     * @param theSearchTransitive the searchTransitive to set
+     */
+    public void setSearchTransitive( boolean theSearchTransitive )
+    {
+        this.searchTransitive = theSearchTransitive;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
+     */
+    public String getCacheId()
+    {
+        return "0";
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
+     */
+    public boolean isCacheable()
+    {
+        // dependencies change per project, therefore they must always be rerun.
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
+     */
+    public boolean isResultValid( EnforcerRule theCachedRule )
+    {
+        // dependencies change per project, therefore they must always be rerun.
+        return false;
+    }
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireFiles.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireFiles.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireFiles.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireFiles.java Sun Mar  2 15:41:23 2008
@@ -1,116 +1,116 @@
-package org.apache.maven.plugins.enforcer;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.apache.maven.enforcer.rule.api.EnforcerRule;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
-
-/**
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- */
-abstract public class AbstractRequireFiles
-    extends AbstractStandardEnforcerRule
-{
-    /**
-     * Array of files to check.
-     */
-    File[] files;
-
-    //check the file for the specific condition
-    abstract boolean checkFile(File file);
-    
-    //retun standard error message
-    abstract String getErrorMsg();
-    
-    public void execute( EnforcerRuleHelper helper )
-        throws EnforcerRuleException
-    {
-
-        ArrayList failures = new ArrayList();
-        for ( int i = 0; i < files.length; i++ )
-        {
-            if ( !checkFile(files[i]) )
-            {
-                failures.add( files[i]);
-            }
-        }
-
-        // if anything was found, log it then append the
-        // optional message.
-        if ( !failures.isEmpty() )
-        {
-            StringBuffer buf = new StringBuffer();
-            if ( message != null )
-            {
-                buf.append( message + "\n" );
-            }
-            buf.append( getErrorMsg() );
-
-            Iterator iter = failures.iterator();
-            while ( iter.hasNext() )
-            {
-                buf.append( ((File)(iter.next())).getAbsolutePath()+ "\n" );
-            }
-
-            throw new EnforcerRuleException( buf.toString() );
-        }
-    }
-
-    /**
-     * If your rule is cacheable, you must return a unique id when parameters or conditions change that would cause the
-     * result to be different. Multiple cached results are stored based on their id. The easiest way to do this is to
-     * return a hash computed from the values of your parameters. If your rule is not cacheable, then the result here is
-     * not important, you may return anything.
-     */
-    public String getCacheId()
-    {
-        return Integer.toString( hashCode( files ) );
-    }
-
-    /**
-     * Calculates a hash code for the specified array as <code>Arrays.hashCode()</code> would do. Unfortunately, the
-     * mentioned method is only available for Java 1.5 and later.
-     * 
-     * @param items The array for which to compute the hash code, may be <code>null</code>.
-     * @return The hash code for the array.
-     */
-    private static int hashCode( Object[] items )
-    {
-        int hash = 0;
-        if ( items != null )
-        {
-            hash = 1;
-            for ( int i = 0; i < items.length; i++ )
-            {
-                Object item = items[i];
-                hash = 31 * hash + ( item == null ? 0 : item.hashCode() );
-            }
-        }
-        return hash;
-    }
-
-    /**
-     * This tells the system if the results are cacheable at all. Keep in mind that during forked builds and other
-     * things, a given rule may be executed more than once for the same project. This means that even things that change
-     * from project to project may still be cacheable in certain instances.
-     */
-    public boolean isCacheable()
-    {
-        return true;
-    }
-
-    /**
-     * If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to
-     * allow double checking of the results. Most of the time this can be done by generating unique ids, but sometimes
-     * the results of objects returned by the helper need to be queried. You may for example, store certain objects in
-     * your rule and then query them later.
-     */
-    public boolean isResultValid( EnforcerRule arg0 )
-    {
-        return true;
-    }
-}
+package org.apache.maven.plugins.enforcer;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+
+/**
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ */
+abstract public class AbstractRequireFiles
+    extends AbstractStandardEnforcerRule
+{
+    /**
+     * Array of files to check.
+     */
+    File[] files;
+
+    //check the file for the specific condition
+    abstract boolean checkFile(File file);
+    
+    //retun standard error message
+    abstract String getErrorMsg();
+    
+    public void execute( EnforcerRuleHelper helper )
+        throws EnforcerRuleException
+    {
+
+        ArrayList failures = new ArrayList();
+        for ( int i = 0; i < files.length; i++ )
+        {
+            if ( !checkFile(files[i]) )
+            {
+                failures.add( files[i]);
+            }
+        }
+
+        // if anything was found, log it then append the
+        // optional message.
+        if ( !failures.isEmpty() )
+        {
+            StringBuffer buf = new StringBuffer();
+            if ( message != null )
+            {
+                buf.append( message + "\n" );
+            }
+            buf.append( getErrorMsg() );
+
+            Iterator iter = failures.iterator();
+            while ( iter.hasNext() )
+            {
+                buf.append( ((File)(iter.next())).getAbsolutePath()+ "\n" );
+            }
+
+            throw new EnforcerRuleException( buf.toString() );
+        }
+    }
+
+    /**
+     * If your rule is cacheable, you must return a unique id when parameters or conditions change that would cause the
+     * result to be different. Multiple cached results are stored based on their id. The easiest way to do this is to
+     * return a hash computed from the values of your parameters. If your rule is not cacheable, then the result here is
+     * not important, you may return anything.
+     */
+    public String getCacheId()
+    {
+        return Integer.toString( hashCode( files ) );
+    }
+
+    /**
+     * Calculates a hash code for the specified array as <code>Arrays.hashCode()</code> would do. Unfortunately, the
+     * mentioned method is only available for Java 1.5 and later.
+     * 
+     * @param items The array for which to compute the hash code, may be <code>null</code>.
+     * @return The hash code for the array.
+     */
+    private static int hashCode( Object[] items )
+    {
+        int hash = 0;
+        if ( items != null )
+        {
+            hash = 1;
+            for ( int i = 0; i < items.length; i++ )
+            {
+                Object item = items[i];
+                hash = 31 * hash + ( item == null ? 0 : item.hashCode() );
+            }
+        }
+        return hash;
+    }
+
+    /**
+     * This tells the system if the results are cacheable at all. Keep in mind that during forked builds and other
+     * things, a given rule may be executed more than once for the same project. This means that even things that change
+     * from project to project may still be cacheable in certain instances.
+     */
+    public boolean isCacheable()
+    {
+        return true;
+    }
+
+    /**
+     * If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to
+     * allow double checking of the results. Most of the time this can be done by generating unique ids, but sometimes
+     * the results of objects returned by the helper need to be queried. You may for example, store certain objects in
+     * your rule and then query them later.
+     */
+    public boolean isResultValid( EnforcerRule arg0 )
+    {
+        return true;
+    }
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireFiles.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractStandardEnforcerRule.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractStandardEnforcerRule.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractStandardEnforcerRule.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractStandardEnforcerRule.java Sun Mar  2 15:41:23 2008
@@ -1,15 +1,15 @@
-package org.apache.maven.plugins.enforcer;
-
-import org.apache.maven.enforcer.rule.api.EnforcerRule;
-
-public abstract class AbstractStandardEnforcerRule
-    implements EnforcerRule
-{
-    /**
-     * Specify a friendly message if the rule fails.
-     * 
-     * @parameter
-     */
-    public String message = null;
-
-}
+package org.apache.maven.plugins.enforcer;
+
+import org.apache.maven.enforcer.rule.api.EnforcerRule;
+
+public abstract class AbstractStandardEnforcerRule
+    implements EnforcerRule
+{
+    /**
+     * Specify a friendly message if the rule fails.
+     * 
+     * @parameter
+     */
+    public String message = null;
+
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractStandardEnforcerRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java Sun Mar  2 15:41:23 2008
@@ -1,206 +1,206 @@
-package org.apache.maven.plugins.enforcer;
-
-/*
- * 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.
- */
-import java.util.Iterator;
-
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.Restriction;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.enforcer.rule.api.EnforcerRule;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * Containts the common code to compare a version against a version range.
- * 
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @version $Id$
- */
-public abstract class AbstractVersionEnforcer
-    extends AbstractStandardEnforcerRule
-{
-
-    /**
-     * Specify the required version. Some examples are
-     * <ul>
-     * <li><code>2.0.4</code> Version 2.0.4</li>
-     * <li><code>[2.0,2.1)</code> Versions 2.0 (included) to 2.1 (not included)</li>
-     * <li><code>[2.0,2.1]</code> Versions 2.0 to 2.1 (both included)</li>
-     * <li><code>[2.0.5,)</code> Versions 2.0.5 and higher</li>
-     * <li><code>(,2.0.5],[2.1.1,)</code> Versions up to 2.0.5 (included) and 2.1.1 or higher</li>
-     * </ul>
-     * 
-     * @parameter
-     * @required
-     */
-    public String version = null;
-
-    /**
-     * Compares the specified version to see if it is allowed by the defined version range.
-     * 
-     * @param log
-     * @param variableName name of variable to use in messages (Example: "Maven" or "Java" etc).
-     * @param requiredVersionRange range of allowed versions.
-     * @param actualVersion the version to be checked.
-     * @throws MojoExecutionException if the version is not allowed.
-     */
-    public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
-        throws EnforcerRuleException
-    {
-        if ( StringUtils.isEmpty( requiredVersionRange ) )
-        {
-            throw new EnforcerRuleException( variableName + " version can't be empty." );
-        }
-        else
-        {
-
-            VersionRange vr;
-            String msg = "Detected " + variableName + " Version: " + actualVersion;
-
-            // stort circuit check if the strings are exactly equal
-            if ( actualVersion.toString().equals( requiredVersionRange ) )
-            {
-                log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
-            }
-            else
-            {
-                try
-                {
-                    vr = VersionRange.createFromVersionSpec( requiredVersionRange );
-
-                    if ( containsVersion( vr, actualVersion ) )
-                    {
-                        log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
-                    }
-                    else
-                    {
-                        if ( StringUtils.isEmpty( message ) )
-                        {
-                            message = msg + " is not in the allowed range " + vr + ".";
-                        }
-
-                        throw new EnforcerRuleException( message );
-                    }
-                }
-                catch ( InvalidVersionSpecificationException e )
-                {
-                    throw new EnforcerRuleException( "The requested " + variableName + " version " +
-                        requiredVersionRange + " is invalid.", e );
-                }
-            }
-        }
-    }
-
-    /**
-     * Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently the default
-     * containsVersion method assumes a singular version means allow everything. This method assumes that "2.0.4" ==
-     * "[2.0.4,)"
-     * 
-     * @param allowedRange range of allowed versions.
-     * @param theVersion the version to be checked.
-     * @return true if the version is contained by the range.
-     */
-    public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
-    {
-        boolean matched = false;
-        ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
-        if ( recommendedVersion == null )
-        {
-
-            for ( Iterator i = allowedRange.getRestrictions().iterator(); i.hasNext() && !matched; )
-            {
-                Restriction restriction = (Restriction) i.next();
-                if ( restriction.containsVersion( theVersion ) )
-                {
-                    matched = true;
-                }
-            }
-        }
-        else
-        {
-            // only singular versions ever have a recommendedVersion
-            int compareTo = recommendedVersion.compareTo( theVersion );
-            matched = ( compareTo <= 0 );
-        }
-        return matched;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
-     */
-    public String getCacheId()
-    {
-        if ( StringUtils.isNotEmpty( version ) )
-        {
-            // return the hashcodes of the parameter that matters
-            return "" + version.hashCode();
-        }
-        else
-        {
-            return "0";
-        }
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
-     */
-    public boolean isCacheable()
-    {
-        // the maven version is not going to change between projects in the same build.
-        return true;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
-     */
-    public boolean isResultValid( EnforcerRule theCachedRule )
-    {
-        // i will always return the hash of the parameters as my id. If my parameters are the same, this
-        // rule must always have the same result.
-        return true;
-    }
-
-    /**
-     * @return the version
-     */
-    public String getVersion()
-    {
-        return this.version;
-    }
-
-    /**
-     * @param theVersion the version to set
-     */
-    public void setVersion( String theVersion )
-    {
-        this.version = theVersion;
-    }
-
-}
+package org.apache.maven.plugins.enforcer;
+
+/*
+ * 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.
+ */
+import java.util.Iterator;
+
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.Restriction;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Containts the common code to compare a version against a version range.
+ * 
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @version $Id$
+ */
+public abstract class AbstractVersionEnforcer
+    extends AbstractStandardEnforcerRule
+{
+
+    /**
+     * Specify the required version. Some examples are
+     * <ul>
+     * <li><code>2.0.4</code> Version 2.0.4</li>
+     * <li><code>[2.0,2.1)</code> Versions 2.0 (included) to 2.1 (not included)</li>
+     * <li><code>[2.0,2.1]</code> Versions 2.0 to 2.1 (both included)</li>
+     * <li><code>[2.0.5,)</code> Versions 2.0.5 and higher</li>
+     * <li><code>(,2.0.5],[2.1.1,)</code> Versions up to 2.0.5 (included) and 2.1.1 or higher</li>
+     * </ul>
+     * 
+     * @parameter
+     * @required
+     */
+    public String version = null;
+
+    /**
+     * Compares the specified version to see if it is allowed by the defined version range.
+     * 
+     * @param log
+     * @param variableName name of variable to use in messages (Example: "Maven" or "Java" etc).
+     * @param requiredVersionRange range of allowed versions.
+     * @param actualVersion the version to be checked.
+     * @throws MojoExecutionException if the version is not allowed.
+     */
+    public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
+        throws EnforcerRuleException
+    {
+        if ( StringUtils.isEmpty( requiredVersionRange ) )
+        {
+            throw new EnforcerRuleException( variableName + " version can't be empty." );
+        }
+        else
+        {
+
+            VersionRange vr;
+            String msg = "Detected " + variableName + " Version: " + actualVersion;
+
+            // stort circuit check if the strings are exactly equal
+            if ( actualVersion.toString().equals( requiredVersionRange ) )
+            {
+                log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
+            }
+            else
+            {
+                try
+                {
+                    vr = VersionRange.createFromVersionSpec( requiredVersionRange );
+
+                    if ( containsVersion( vr, actualVersion ) )
+                    {
+                        log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
+                    }
+                    else
+                    {
+                        if ( StringUtils.isEmpty( message ) )
+                        {
+                            message = msg + " is not in the allowed range " + vr + ".";
+                        }
+
+                        throw new EnforcerRuleException( message );
+                    }
+                }
+                catch ( InvalidVersionSpecificationException e )
+                {
+                    throw new EnforcerRuleException( "The requested " + variableName + " version " +
+                        requiredVersionRange + " is invalid.", e );
+                }
+            }
+        }
+    }
+
+    /**
+     * Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently the default
+     * containsVersion method assumes a singular version means allow everything. This method assumes that "2.0.4" ==
+     * "[2.0.4,)"
+     * 
+     * @param allowedRange range of allowed versions.
+     * @param theVersion the version to be checked.
+     * @return true if the version is contained by the range.
+     */
+    public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
+    {
+        boolean matched = false;
+        ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
+        if ( recommendedVersion == null )
+        {
+
+            for ( Iterator i = allowedRange.getRestrictions().iterator(); i.hasNext() && !matched; )
+            {
+                Restriction restriction = (Restriction) i.next();
+                if ( restriction.containsVersion( theVersion ) )
+                {
+                    matched = true;
+                }
+            }
+        }
+        else
+        {
+            // only singular versions ever have a recommendedVersion
+            int compareTo = recommendedVersion.compareTo( theVersion );
+            matched = ( compareTo <= 0 );
+        }
+        return matched;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
+     */
+    public String getCacheId()
+    {
+        if ( StringUtils.isNotEmpty( version ) )
+        {
+            // return the hashcodes of the parameter that matters
+            return "" + version.hashCode();
+        }
+        else
+        {
+            return "0";
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
+     */
+    public boolean isCacheable()
+    {
+        // the maven version is not going to change between projects in the same build.
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
+     */
+    public boolean isResultValid( EnforcerRule theCachedRule )
+    {
+        // i will always return the hash of the parameters as my id. If my parameters are the same, this
+        // rule must always have the same result.
+        return true;
+    }
+
+    /**
+     * @return the version
+     */
+    public String getVersion()
+    {
+        return this.version;
+    }
+
+    /**
+     * @param theVersion the version to set
+     */
+    public void setVersion( String theVersion )
+    {
+        this.version = theVersion;
+    }
+
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedDependencies.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedDependencies.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedDependencies.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedDependencies.java Sun Mar  2 15:41:23 2008
@@ -1,217 +1,217 @@
-package org.apache.maven.plugins.enforcer;
-
-/*
- * 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.
- */
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.plugin.logging.Log;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * This rule checks that lists of dependencies are not included.
- * 
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @version $Id$
- */
-public class BannedDependencies
-    extends AbstractBanDependencies
-{
-
-    /**
-     * Specify the banned dependencies. This can be a list of artifacts in the format groupId[:artifactId][:version] Any
-     * of the sections can be a wildcard by using '*' (ie group:*:1.0) <br>
-     * The rule will fail if any dependencies match any exclude, unless it also matches an include rule.
-     * 
-     * @parameter
-     * @required
-     */
-    public List excludes = null;
-
-    /**
-     * Specify the allowed dependencies. This can be a list of artifacts in the format groupId[:artifactId][:version]
-     * Any of the sections can be a wildcard by using '*' (ie group:*:1.0) <br>
-     * Includes override the exclude rules. It is meant to allow wide exclusion rules with wildcards and still allow a
-     * smaller set of includes. <br>
-     * For example, to ban all xerces except xerces-api -> exclude "xerces", include "xerces:xerces-api"
-     * 
-     * @parameter default-value="*"
-     * @required
-     */
-    public List includes = null;
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.plugin.enforcer.AbstractBanDependencies#checkDependencies(java.util.Set)
-     */
-    protected Set checkDependencies( Set theDependencies, Log log )
-        throws EnforcerRuleException
-    {
-        Set excluded = checkDependencies( theDependencies, excludes );
-
-        // anything specifically included should be removed
-        // from the ban list.
-        if ( excluded != null )
-        {
-            Set included = checkDependencies( theDependencies, includes );
-            if ( included != null )
-            {
-                excluded.removeAll( included );
-            }
-        }
-        return excluded;
-
-    }
-
-    /**
-     * Checks the set of dependencies against the list of patterns
-     * 
-     * @param thePatterns
-     * @param dependencies
-     * @return
-     * @throws EnforcerRuleException
-     */
-    private Set checkDependencies( Set dependencies, List thePatterns )
-        throws EnforcerRuleException
-    {
-        Set foundMatches = null;
-
-        if ( thePatterns != null && thePatterns.size() > 0 )
-        {
-
-            Iterator iter = thePatterns.iterator();
-            while ( iter.hasNext() )
-            {
-                String pattern = (String) iter.next();
-
-                String[] subStrings = pattern.split( ":" );
-                subStrings = StringUtils.stripAll( subStrings );
-
-                Iterator DependencyIter = dependencies.iterator();
-                while ( DependencyIter.hasNext() )
-                {
-                    Artifact artifact = (Artifact) DependencyIter.next();
-
-                    if ( compareDependency( subStrings, artifact ) )
-                    {
-                        // only create if needed
-                        if ( foundMatches == null )
-                        {
-                            foundMatches = new HashSet();
-                        }
-                        foundMatches.add( artifact );
-                    }
-                }
-            }
-        }
-        return foundMatches;
-    }
-
-    /**
-     * Compares the parsed array of substrings against the artifact
-     * 
-     * @param pattern
-     * @param artifact
-     * @return
-     * @throws EnforcerRuleException
-     */
-    protected boolean compareDependency( String[] pattern, Artifact artifact )
-        throws EnforcerRuleException
-    {
-
-        boolean result = false;
-        if ( pattern.length > 0 )
-        {
-            result = pattern[0].equals( "*" ) || artifact.getGroupId().equals( pattern[0] );
-        }
-
-        if ( result && pattern.length > 1 )
-        {
-            result = pattern[1].equals( "*" ) || artifact.getArtifactId().equals( pattern[1] );
-        }
-
-        if ( result && pattern.length > 2 )
-        {
-            // short circuit if the versions are exactly the
-            // same
-            if ( pattern[2].equals( "*" ) || artifact.getVersion().equals( pattern[2] ) )
-            {
-                result = true;
-            }
-            else
-            {
-                try
-                {
-                    result =
-                        AbstractVersionEnforcer.containsVersion( VersionRange.createFromVersionSpec( pattern[2] ),
-                                                                 new DefaultArtifactVersion( artifact.getVersion() ) );
-                }
-                catch ( InvalidVersionSpecificationException e )
-                {
-                    throw new EnforcerRuleException( "Invalid Version Range: ", e );
-                }
-            }
-        }
-
-        return result;
-
-    }
-
-    /**
-     * @return the excludes
-     */
-    public List getExcludes()
-    {
-        return this.excludes;
-    }
-
-    /**
-     * @param theExcludes the excludes to set
-     */
-    public void setExcludes( List theExcludes )
-    {
-        this.excludes = theExcludes;
-    }
-
-    /**
-     * @return the includes
-     */
-    public List getIncludes()
-    {
-        return this.includes;
-    }
-
-    /**
-     * @param theIncludes the includes to set
-     */
-    public void setIncludes( List theIncludes )
-    {
-        this.includes = theIncludes;
-    }
-
-}
+package org.apache.maven.plugins.enforcer;
+
+/*
+ * 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.
+ */
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * This rule checks that lists of dependencies are not included.
+ * 
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @version $Id$
+ */
+public class BannedDependencies
+    extends AbstractBanDependencies
+{
+
+    /**
+     * Specify the banned dependencies. This can be a list of artifacts in the format groupId[:artifactId][:version] Any
+     * of the sections can be a wildcard by using '*' (ie group:*:1.0) <br>
+     * The rule will fail if any dependencies match any exclude, unless it also matches an include rule.
+     * 
+     * @parameter
+     * @required
+     */
+    public List excludes = null;
+
+    /**
+     * Specify the allowed dependencies. This can be a list of artifacts in the format groupId[:artifactId][:version]
+     * Any of the sections can be a wildcard by using '*' (ie group:*:1.0) <br>
+     * Includes override the exclude rules. It is meant to allow wide exclusion rules with wildcards and still allow a
+     * smaller set of includes. <br>
+     * For example, to ban all xerces except xerces-api -> exclude "xerces", include "xerces:xerces-api"
+     * 
+     * @parameter default-value="*"
+     * @required
+     */
+    public List includes = null;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.plugin.enforcer.AbstractBanDependencies#checkDependencies(java.util.Set)
+     */
+    protected Set checkDependencies( Set theDependencies, Log log )
+        throws EnforcerRuleException
+    {
+        Set excluded = checkDependencies( theDependencies, excludes );
+
+        // anything specifically included should be removed
+        // from the ban list.
+        if ( excluded != null )
+        {
+            Set included = checkDependencies( theDependencies, includes );
+            if ( included != null )
+            {
+                excluded.removeAll( included );
+            }
+        }
+        return excluded;
+
+    }
+
+    /**
+     * Checks the set of dependencies against the list of patterns
+     * 
+     * @param thePatterns
+     * @param dependencies
+     * @return
+     * @throws EnforcerRuleException
+     */
+    private Set checkDependencies( Set dependencies, List thePatterns )
+        throws EnforcerRuleException
+    {
+        Set foundMatches = null;
+
+        if ( thePatterns != null && thePatterns.size() > 0 )
+        {
+
+            Iterator iter = thePatterns.iterator();
+            while ( iter.hasNext() )
+            {
+                String pattern = (String) iter.next();
+
+                String[] subStrings = pattern.split( ":" );
+                subStrings = StringUtils.stripAll( subStrings );
+
+                Iterator DependencyIter = dependencies.iterator();
+                while ( DependencyIter.hasNext() )
+                {
+                    Artifact artifact = (Artifact) DependencyIter.next();
+
+                    if ( compareDependency( subStrings, artifact ) )
+                    {
+                        // only create if needed
+                        if ( foundMatches == null )
+                        {
+                            foundMatches = new HashSet();
+                        }
+                        foundMatches.add( artifact );
+                    }
+                }
+            }
+        }
+        return foundMatches;
+    }
+
+    /**
+     * Compares the parsed array of substrings against the artifact
+     * 
+     * @param pattern
+     * @param artifact
+     * @return
+     * @throws EnforcerRuleException
+     */
+    protected boolean compareDependency( String[] pattern, Artifact artifact )
+        throws EnforcerRuleException
+    {
+
+        boolean result = false;
+        if ( pattern.length > 0 )
+        {
+            result = pattern[0].equals( "*" ) || artifact.getGroupId().equals( pattern[0] );
+        }
+
+        if ( result && pattern.length > 1 )
+        {
+            result = pattern[1].equals( "*" ) || artifact.getArtifactId().equals( pattern[1] );
+        }
+
+        if ( result && pattern.length > 2 )
+        {
+            // short circuit if the versions are exactly the
+            // same
+            if ( pattern[2].equals( "*" ) || artifact.getVersion().equals( pattern[2] ) )
+            {
+                result = true;
+            }
+            else
+            {
+                try
+                {
+                    result =
+                        AbstractVersionEnforcer.containsVersion( VersionRange.createFromVersionSpec( pattern[2] ),
+                                                                 new DefaultArtifactVersion( artifact.getVersion() ) );
+                }
+                catch ( InvalidVersionSpecificationException e )
+                {
+                    throw new EnforcerRuleException( "Invalid Version Range: ", e );
+                }
+            }
+        }
+
+        return result;
+
+    }
+
+    /**
+     * @return the excludes
+     */
+    public List getExcludes()
+    {
+        return this.excludes;
+    }
+
+    /**
+     * @param theExcludes the excludes to set
+     */
+    public void setExcludes( List theExcludes )
+    {
+        this.excludes = theExcludes;
+    }
+
+    /**
+     * @return the includes
+     */
+    public List getIncludes()
+    {
+        return this.includes;
+    }
+
+    /**
+     * @param theIncludes the includes to set
+     */
+    public void setIncludes( List theIncludes )
+    {
+        this.includes = theIncludes;
+    }
+
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedDependencies.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DefaultEnforcementRuleHelper.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DefaultEnforcementRuleHelper.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DefaultEnforcementRuleHelper.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DefaultEnforcementRuleHelper.java Sun Mar  2 15:41:23 2008
@@ -1,158 +1,158 @@
-package org.apache.maven.plugins.enforcer;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.logging.Log;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-
-/**
- * Default implementation of the EnforcementRuleHelper interface. This is used to help retreive information from the
- * session and provide usefull elements like the log.
- * 
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @version $Id$
- */
-public class DefaultEnforcementRuleHelper
-    implements EnforcerRuleHelper
-{
-    Log log;
-
-    ExpressionEvaluator evaluator;
-
-    MavenSession session;
-
-    PlexusContainer container;
-
-    public DefaultEnforcementRuleHelper( MavenSession session, ExpressionEvaluator evaluator, Log log,
-                                         PlexusContainer container )
-    {
-        this.evaluator = evaluator;
-        this.log = log;
-        this.session = session;
-        if ( container != null )
-        {
-            this.container = container;
-        }
-        else
-        {
-            this.container = session.getContainer();
-        }
-    }
-
-    public Log getLog()
-    {
-        return log;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#alignToBaseDirectory(java.io.File)
-     */
-    public File alignToBaseDirectory( File theFile )
-    {
-        return evaluator.alignToBaseDirectory( theFile );
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#evaluate(java.lang.String)
-     */
-    public Object evaluate( String theExpression )
-        throws ExpressionEvaluationException
-    {
-        return evaluator.evaluate( theExpression );
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper#getRuntimeInformation()
-     */
-    public Object getComponent( Class clazz )
-        throws ComponentLookupException
-    {
-        return getComponent( clazz.getName() );
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookup(java.lang.String)
-     */
-    public Object getComponent( String theComponentKey )
-        throws ComponentLookupException
-    {
-        return container.lookup( theComponentKey );
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookup(java.lang.String, java.lang.String)
-     */
-    public Object getComponent( String theRole, String theRoleHint )
-        throws ComponentLookupException
-    {
-        return container.lookup( theRole, theRoleHint );
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookupList(java.lang.String)
-     */
-    public List getComponentList( String theRole )
-        throws ComponentLookupException
-    {
-        return container.lookupList( theRole );
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookupMap(java.lang.String)
-     */
-    public Map getComponentMap( String theRole )
-        throws ComponentLookupException
-    {
-        return container.lookupMap( theRole );
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#getContainer()
-     */
-    public PlexusContainer getContainer()
-    {
-        return container;
-    }
-}
+package org.apache.maven.plugins.enforcer;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+/**
+ * Default implementation of the EnforcementRuleHelper interface. This is used to help retreive information from the
+ * session and provide usefull elements like the log.
+ * 
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @version $Id$
+ */
+public class DefaultEnforcementRuleHelper
+    implements EnforcerRuleHelper
+{
+    Log log;
+
+    ExpressionEvaluator evaluator;
+
+    MavenSession session;
+
+    PlexusContainer container;
+
+    public DefaultEnforcementRuleHelper( MavenSession session, ExpressionEvaluator evaluator, Log log,
+                                         PlexusContainer container )
+    {
+        this.evaluator = evaluator;
+        this.log = log;
+        this.session = session;
+        if ( container != null )
+        {
+            this.container = container;
+        }
+        else
+        {
+            this.container = session.getContainer();
+        }
+    }
+
+    public Log getLog()
+    {
+        return log;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#alignToBaseDirectory(java.io.File)
+     */
+    public File alignToBaseDirectory( File theFile )
+    {
+        return evaluator.alignToBaseDirectory( theFile );
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#evaluate(java.lang.String)
+     */
+    public Object evaluate( String theExpression )
+        throws ExpressionEvaluationException
+    {
+        return evaluator.evaluate( theExpression );
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper#getRuntimeInformation()
+     */
+    public Object getComponent( Class clazz )
+        throws ComponentLookupException
+    {
+        return getComponent( clazz.getName() );
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookup(java.lang.String)
+     */
+    public Object getComponent( String theComponentKey )
+        throws ComponentLookupException
+    {
+        return container.lookup( theComponentKey );
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookup(java.lang.String, java.lang.String)
+     */
+    public Object getComponent( String theRole, String theRoleHint )
+        throws ComponentLookupException
+    {
+        return container.lookup( theRole, theRoleHint );
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookupList(java.lang.String)
+     */
+    public List getComponentList( String theRole )
+        throws ComponentLookupException
+    {
+        return container.lookupList( theRole );
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#lookupMap(java.lang.String)
+     */
+    public Map getComponentMap( String theRole )
+        throws ComponentLookupException
+    {
+        return container.lookupMap( theRole );
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRuleHelper#getContainer()
+     */
+    public PlexusContainer getContainer()
+    {
+        return container;
+    }
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DefaultEnforcementRuleHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java Sun Mar  2 15:41:23 2008
@@ -1,31 +1,31 @@
-package org.apache.maven.plugins.enforcer;
-
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.path.PathTranslator;
-
-/**
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a> This class wraps the PluginParameterExpressionEvaluator
- *         because it can't be accessed directly in 2.0.x so we must create a new one.
- */
-public class EnforcerExpressionEvaluator
-    extends PluginParameterExpressionEvaluator
-{
-
-    /**
-     * @param theContext
-     * @param theMojoExecution
-     * @param thePathTranslator
-     * @param theProject
-     */
-    public EnforcerExpressionEvaluator( MavenSession theContext, PathTranslator thePathTranslator,
-                                        MavenProject theProject )
-    {
-        super( theContext, new MojoExecution( new MojoDescriptor() ), thePathTranslator, null, theProject,
-               theContext.getExecutionProperties() );
-    }
-
-}
+package org.apache.maven.plugins.enforcer;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.path.PathTranslator;
+
+/**
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a> This class wraps the PluginParameterExpressionEvaluator
+ *         because it can't be accessed directly in 2.0.x so we must create a new one.
+ */
+public class EnforcerExpressionEvaluator
+    extends PluginParameterExpressionEvaluator
+{
+
+    /**
+     * @param theContext
+     * @param theMojoExecution
+     * @param thePathTranslator
+     * @param theProject
+     */
+    public EnforcerExpressionEvaluator( MavenSession theContext, PathTranslator thePathTranslator,
+                                        MavenProject theProject )
+    {
+        super( theContext, new MojoExecution( new MojoDescriptor() ), thePathTranslator, null, theProject,
+               theContext.getExecutionProperties() );
+    }
+
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforcerExpressionEvaluator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EvaluateBeanshell.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/NoSnapshots.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/NoSnapshots.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/NoSnapshots.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/NoSnapshots.java Sun Mar  2 15:41:23 2008
@@ -1,52 +1,52 @@
-package org.apache.maven.plugins.enforcer;
-
-/*
- * 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.
- */
-
-import java.util.Set;
-
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * This rule is deprecated. Use requireReleaseVersions
- * 
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @version $Id$
- * @deprecated replaced by {@link #RequireReleaseDeps}
- */
-public class NoSnapshots
-    extends AbstractBanDependencies
-{
-
-    /**
-     * Checks the set of dependencies to see if any snapshots are included
-     * 
-     * @param dependencies
-     * @return
-     * @throws EnforcerRuleException
-     */
-    protected Set checkDependencies( Set dependencies, Log log )
-        throws EnforcerRuleException
-    {
-        log.warn( "The \"NoSnapshots\" rule is deprecated. Use \"requireReleaseDeps\" instead" );
-        RequireReleaseDeps rule = new RequireReleaseDeps();
-        return rule.checkDependencies( dependencies, log );
-    }
-}
+package org.apache.maven.plugins.enforcer;
+
+/*
+ * 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.
+ */
+
+import java.util.Set;
+
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * This rule is deprecated. Use requireReleaseVersions
+ * 
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @version $Id$
+ * @deprecated replaced by {@link #RequireReleaseDeps}
+ */
+public class NoSnapshots
+    extends AbstractBanDependencies
+{
+
+    /**
+     * Checks the set of dependencies to see if any snapshots are included
+     * 
+     * @param dependencies
+     * @return
+     * @throws EnforcerRuleException
+     */
+    protected Set checkDependencies( Set dependencies, Log log )
+        throws EnforcerRuleException
+    {
+        log.warn( "The \"NoSnapshots\" rule is deprecated. Use \"requireReleaseDeps\" instead" );
+        RequireReleaseDeps rule = new RequireReleaseDeps();
+        return rule.checkDependencies( dependencies, log );
+    }
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/NoSnapshots.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java Sun Mar  2 15:41:23 2008
@@ -1,147 +1,147 @@
-package org.apache.maven.plugins.enforcer;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.maven.enforcer.rule.api.EnforcerRule;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
-import org.apache.maven.model.Profile;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a> This rule checks that the current project is not a snapshot
- */
-public class RequireActiveProfile
-    extends AbstractStandardEnforcerRule
-{
-
-    /**
-     * Comma separated list of profiles to check
-     */
-    public String profiles = null;
-
-    /**
-     * If all profiles must be active. If false, only one must be active
-     */
-    public boolean all = true;
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
-     */
-    public void execute( EnforcerRuleHelper theHelper )
-        throws EnforcerRuleException
-    {
-        List missingProfiles = new ArrayList();
-        try
-        {
-            MavenProject project = (MavenProject) theHelper.evaluate( "${project}" );
-            if ( StringUtils.isNotEmpty( profiles ) )
-            {
-                String[] profs = profiles.split( "," );
-                for ( int i = 0; i < profs.length; i++ )
-                {
-                    if ( !isProfileActive( project, profs[i] ) )
-                    {
-                        missingProfiles.add( profs[i] );
-                    }
-                }
-
-                boolean fail = false;
-                if ( !missingProfiles.isEmpty() )
-                {
-                    fail = true;
-                    // if (all && missingProfiles.size() != profs.length)
-                    // {
-                    // fail = true;
-                    // }
-                    // else
-                    // {
-                    // if (!all && missingProfiles.size() >= (profs.length -1))
-                    // {
-                    // fail = true;
-                    // }
-                    // }
-                }
-
-                if ( fail )
-                {
-                    StringBuffer buf = new StringBuffer();
-                    if ( message != null )
-                    {
-                        buf.append( message + "\n" );
-                    }
-
-                    Iterator iter = missingProfiles.iterator();
-                    while ( iter.hasNext() )
-                    {
-                        buf.append( "Profile \"" + iter.next().toString() + "\" is not activated.\n" );
-                    }
-
-                    throw new EnforcerRuleException( buf.toString() );
-                }
-
-            }
-
-        }
-        catch ( ExpressionEvaluationException e )
-        {
-            throw new EnforcerRuleException( "Unable to retrieve the project.", e );
-        }
-
-    }
-
-    protected boolean isProfileActive( MavenProject project, String profileName )
-    {
-        List activeProfiles = project.getActiveProfiles();
-        if ( activeProfiles != null && !activeProfiles.isEmpty() )
-        {
-            for ( Iterator it = activeProfiles.iterator(); it.hasNext(); )
-            {
-                Profile profile = (Profile) it.next();
-                if ( profile.getId().equals( profileName ) )
-                {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
-     */
-    public String getCacheId()
-    {
-        return "0";
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
-     */
-    public boolean isCacheable()
-    {
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
-     */
-    public boolean isResultValid( EnforcerRule theCachedRule )
-    {
-        return false;
-    }
-
-}
+package org.apache.maven.plugins.enforcer;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+import org.apache.maven.model.Profile;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a> This rule checks that the current project is not a snapshot
+ */
+public class RequireActiveProfile
+    extends AbstractStandardEnforcerRule
+{
+
+    /**
+     * Comma separated list of profiles to check
+     */
+    public String profiles = null;
+
+    /**
+     * If all profiles must be active. If false, only one must be active
+     */
+    public boolean all = true;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
+     */
+    public void execute( EnforcerRuleHelper theHelper )
+        throws EnforcerRuleException
+    {
+        List missingProfiles = new ArrayList();
+        try
+        {
+            MavenProject project = (MavenProject) theHelper.evaluate( "${project}" );
+            if ( StringUtils.isNotEmpty( profiles ) )
+            {
+                String[] profs = profiles.split( "," );
+                for ( int i = 0; i < profs.length; i++ )
+                {
+                    if ( !isProfileActive( project, profs[i] ) )
+                    {
+                        missingProfiles.add( profs[i] );
+                    }
+                }
+
+                boolean fail = false;
+                if ( !missingProfiles.isEmpty() )
+                {
+                    fail = true;
+                    // if (all && missingProfiles.size() != profs.length)
+                    // {
+                    // fail = true;
+                    // }
+                    // else
+                    // {
+                    // if (!all && missingProfiles.size() >= (profs.length -1))
+                    // {
+                    // fail = true;
+                    // }
+                    // }
+                }
+
+                if ( fail )
+                {
+                    StringBuffer buf = new StringBuffer();
+                    if ( message != null )
+                    {
+                        buf.append( message + "\n" );
+                    }
+
+                    Iterator iter = missingProfiles.iterator();
+                    while ( iter.hasNext() )
+                    {
+                        buf.append( "Profile \"" + iter.next().toString() + "\" is not activated.\n" );
+                    }
+
+                    throw new EnforcerRuleException( buf.toString() );
+                }
+
+            }
+
+        }
+        catch ( ExpressionEvaluationException e )
+        {
+            throw new EnforcerRuleException( "Unable to retrieve the project.", e );
+        }
+
+    }
+
+    protected boolean isProfileActive( MavenProject project, String profileName )
+    {
+        List activeProfiles = project.getActiveProfiles();
+        if ( activeProfiles != null && !activeProfiles.isEmpty() )
+        {
+            for ( Iterator it = activeProfiles.iterator(); it.hasNext(); )
+            {
+                Profile profile = (Profile) it.next();
+                if ( profile.getId().equals( profileName ) )
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
+     */
+    public String getCacheId()
+    {
+        return "0";
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
+     */
+    public boolean isCacheable()
+    {
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
+     */
+    public boolean isResultValid( EnforcerRule theCachedRule )
+    {
+        return false;
+    }
+
+}

Propchange: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFilesDontExist.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFilesDontExist.java?rev=632882&r1=632881&r2=632882&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFilesDontExist.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFilesDontExist.java Sun Mar  2 15:41:23 2008
@@ -1,19 +1,19 @@
-package org.apache.maven.plugins.enforcer;
-
-import java.io.File;
-
-public class RequireFilesDontExist
-    extends AbstractRequireFiles
-{
-
-    boolean checkFile( File file )
-    {
-        return !file.exists();
-    }
-
-    String getErrorMsg()
-    {
-        return "Some files should not exist:\n";
-    }
-
-}
+package org.apache.maven.plugins.enforcer;
+
+import java.io.File;
+
+public class RequireFilesDontExist
+    extends AbstractRequireFiles
+{
+
+    boolean checkFile( File file )
+    {
+        return !file.exists();
+    }
+
+    String getErrorMsg()
+    {
+        return "Some files should not exist:\n";
+    }
+
+}



Mime
View raw message