Author: brianf
Date: Fri Nov 16 01:38:04 2007
New Revision: 595611
URL: http://svn.apache.org/viewvc?rev=595611&view=rev
Log:
renamed rule
Added:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireReleaseDeps.java
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedDependencies.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/NoSnapshots.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java
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=595611&r1=595610&r2=595611&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
Fri Nov 16 01:38:04 2007
@@ -26,6 +26,7 @@
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;
@@ -85,7 +86,7 @@
}
// look for banned dependencies
- Set foundExcludes = checkDependencies( dependencies );
+ Set foundExcludes = checkDependencies( dependencies, helper.getLog() );
// if any are found, fail the check but list all of
// them
@@ -116,7 +117,7 @@
* @return
* @throws EnforcerRuleException
*/
- abstract protected Set checkDependencies( Set dependencies )
+ abstract protected Set checkDependencies( Set dependencies, Log log )
throws EnforcerRuleException;
/**
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=595611&r1=595610&r2=595611&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
Fri Nov 16 01:38:04 2007
@@ -29,6 +29,7 @@
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;
/**
@@ -79,7 +80,7 @@
*
* @see
org.apache.maven.plugin.enforcer.AbstractBanDependencies#checkDependencies(java.util.Set)
*/
- protected Set checkDependencies ( Set theDependencies )
+ protected Set checkDependencies ( Set theDependencies, Log log )
throws EnforcerRuleException
{
Set excluded = checkDependencies( theDependencies, excludes );
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=595611&r1=595610&r2=595611&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
Fri Nov 16 01:38:04 2007
@@ -19,19 +19,17 @@
* under the License.
*/
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
-import org.apache.maven.artifact.Artifact;
import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.plugin.logging.Log;
/**
- * This rule checks that no snapshots are included.
+ * This rule is deprecated. Use requireReleaseVersions
*
* @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
* @version $Id$
- *
+ * @deprecated replaced by [EMAIL PROTECTED] #RequireReleaseDeps}
*/
public class NoSnapshots
extends AbstractBanDependencies
@@ -45,22 +43,11 @@
* @return
* @throws EnforcerRuleException
*/
- protected Set checkDependencies( Set dependencies )
+ protected Set checkDependencies( Set dependencies, Log log )
throws EnforcerRuleException
{
- Set foundExcludes = new HashSet();
-
- Iterator DependencyIter = dependencies.iterator();
- while ( DependencyIter.hasNext() )
- {
- Artifact artifact = (Artifact) DependencyIter.next();
-
- if ( artifact.isSnapshot() )
- {
- foundExcludes.add( artifact );
- }
- }
-
- return foundExcludes;
+ log.warn( "The \"NoSnapshots\" rule is deprecated. Use
\"requireReleaseDeps\" instead" );
+ RequireReleaseDeps rule = new RequireReleaseDeps();
+ return rule.checkDependencies( dependencies, log );
}
}
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=595611&r1=595610&r2=595611&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
Fri Nov 16 01:38:04 2007
@@ -66,17 +66,18 @@
boolean fail = false;
if ( !missingProfiles.isEmpty() )
{
- if (all && missingProfiles.size() != profs.length)
- {
- fail = true;
- }
- else
- {
- if (!all && missingProfiles.size() >= (profs.length
-1))
- {
- fail = true;
- }
- }
+ fail = true;
+// if (all && missingProfiles.size() != profs.length)
+// {
+// fail = true;
+// }
+// else
+// {
+// if (!all && missingProfiles.size() >= (profs.length
-1))
+// {
+// fail = true;
+// }
+// }
}
if ( fail )
Added:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireReleaseDeps.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireReleaseDeps.java?rev=595611&view=auto
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireReleaseDeps.java
(added)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireReleaseDeps.java
Fri Nov 16 01:38:04 2007
@@ -0,0 +1,67 @@
+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.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * This rule checks that no snapshots are included.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
+ * @version $Id$
+ *
+ */
+public class RequireReleaseDeps
+ 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
+ {
+ Set foundExcludes = new HashSet();
+
+ Iterator DependencyIter = dependencies.iterator();
+ while ( DependencyIter.hasNext() )
+ {
+ Artifact artifact = (Artifact) DependencyIter.next();
+
+ if ( artifact.isSnapshot() )
+ {
+ foundExcludes.add( artifact );
+ }
+ }
+
+ return foundExcludes;
+ }
+}