[maven-release-plugin] copy for tag enforcer-1.0-beta-1
git-svn-id: https://svn.apache.org/repos/asf/maven/enforcer/tags/enforcer-1.0-beta-1@746861 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/enforcer-api/pom.xml b/enforcer-api/pom.xml
index a0b56ac..c267368 100644
--- a/enforcer-api/pom.xml
+++ b/enforcer-api/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
- <version>2-SNAPSHOT</version>
+ <version>1.0-beta-1</version>
</parent>
<artifactId>enforcer-api</artifactId>
- <version>1.0-alpha-5-SNAPSHOT</version>
+ <version>1.0-beta-1</version>
<packaging>jar</packaging>
<name>Enforcer API</name>
diff --git a/enforcer-api/src/custom-rule-sample/pom.xml b/enforcer-api/src/custom-rule-sample/pom.xml
index 9940ba9..6e0e814 100644
--- a/enforcer-api/src/custom-rule-sample/pom.xml
+++ b/enforcer-api/src/custom-rule-sample/pom.xml
@@ -8,7 +8,7 @@
<name>My Custom Rule</name>
<description>This is my custom rule.</description>
<properties>
- <api.version>1.0-alpha-4</api.version>
+ <api.version>1.0-beta-1</api.version>
<maven.version>2.0.9</maven.version>
</properties>
<build>
diff --git a/enforcer-api/src/custom-rule-sample/usage-pom.xml b/enforcer-api/src/custom-rule-sample/usage-pom.xml
index db70b90..fbb27dd 100644
--- a/enforcer-api/src/custom-rule-sample/usage-pom.xml
+++ b/enforcer-api/src/custom-rule-sample/usage-pom.xml
@@ -9,7 +9,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-alpha-4</version>
+ <version>1.0-beta-1</version>
<dependencies>
<dependency>
<groupId>custom-rule</groupId>
diff --git a/enforcer-api/src/site/apt/writing-a-custom-rule.apt b/enforcer-api/src/site/apt/writing-a-custom-rule.apt
index fee48cd..936f5c0 100644
--- a/enforcer-api/src/site/apt/writing-a-custom-rule.apt
+++ b/enforcer-api/src/site/apt/writing-a-custom-rule.apt
@@ -43,7 +43,7 @@
<name>My Custom Rule</name>
<description>This is my custom rule.</description>
<properties>
- <api.version>1.0-alpha-4</api.version>
+ <api.version>1.0-beta-1</api.version>
<maven.version>2.0.9</maven.version>
</properties>
<build>
@@ -95,7 +95,7 @@
There are several methods that must be implemented related to caching.
- Here's a sample class that shows how to access the helper methods and retreive components by class name from the helper:
+ Here's a sample class that shows how to access the helper methods and retrieve components by class name from the helper:
+---+
package org.apache.maven.enforcer.rule;
@@ -135,7 +135,7 @@
String target = (String) helper.evaluate( "${project.build.directory}" );
String artifactId = (String) helper.evaluate( "${project.artifactId}" );
- // retreive any component out of the session directly
+ // retrieveany component out of the session directly
ArtifactResolver resolver = (ArtifactResolver) helper.getComponent( ArtifactResolver.class );
RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
@@ -253,7 +253,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-alpha-4</version>
+ <version>1.0-beta-1</version>
<dependencies>
<dependency>
<groupId>custom-rule</groupId>
diff --git a/enforcer-rules/pom.xml b/enforcer-rules/pom.xml
index 7caeedd..6e06dc6 100644
--- a/enforcer-rules/pom.xml
+++ b/enforcer-rules/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
- <version>2-SNAPSHOT</version>
+ <version>1.0-beta-1</version>
</parent>
<artifactId>enforcer-rules</artifactId>
- <version>1.0-alpha-5-SNAPSHOT</version>
+ <version>1.0-beta-1</version>
<packaging>jar</packaging>
<name>Enforcer Rules</name>
diff --git a/enforcer-rules/src/it/requirePluginsUnchecked/pom.xml b/enforcer-rules/src/it/requirePluginsUnchecked/pom.xml
index a63ecf1..0d20c16 100644
--- a/enforcer-rules/src/it/requirePluginsUnchecked/pom.xml
+++ b/enforcer-rules/src/it/requirePluginsUnchecked/pom.xml
@@ -13,7 +13,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>2.0-beta-6</version>
+
</plugin>
</plugins>
</pluginManagement>
@@ -21,7 +21,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-beta-1-SNAPSHOT</version>
<executions>
<execution>
<goals>
@@ -32,8 +32,9 @@
<requirePluginVersions>
<phases>site</phases>
<unCheckedPlugins>
- <unCheckedPlugin>org.apache.maven.plugins:maven-enforcer-plugin</unCheckedPlugin>
+ <unCheckedPlugin>org.apache.maven.plugins:maven-site-plugin</unCheckedPlugin>
</unCheckedPlugins>
+ <unCheckedPluginList>org.apache.maven.plugins : maven-enforcer-plugin</unCheckedPluginList>
</requirePluginVersions>
</rules>
</configuration>
diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
index 4f5dd99..4a50c8c 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
@@ -21,6 +21,7 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -66,6 +67,7 @@
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.util.CollectionUtils;
import org.codehaus.plexus.util.ReflectionUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -108,9 +110,16 @@
/**
* Plugins to skip for version enforcement. The plugins should be specified in the form:
- * <code>group:artifactId</code>.
+ * <code>group:artifactId</code>. NOTE: This is deprecated, use unCheckedPluginList instead.
+ * @deprecated
*/
public List unCheckedPlugins;
+
+ /**
+ * Same as unCheckedPlugins but as a comma list to better support properties. Sample form:
+ * <code>group:artifactId,group2:artifactId2</code>
+ */
+ public String unCheckedPluginList;
/** The plugin manager. */
private PluginManager pluginManager;
@@ -191,8 +200,9 @@
allPlugins = addAdditionalPlugins( allPlugins, additionalPlugins );
allPlugins.addAll( getProfilePlugins( project ) );
+
// pull out any we should skip
- allPlugins = (Set) removeUncheckedPlugins( unCheckedPlugins, allPlugins );
+ allPlugins = (Set) removeUncheckedPlugins( combineUncheckedPlugins( unCheckedPlugins, unCheckedPluginList ), allPlugins );
// there's nothing to do here
if ( allPlugins.isEmpty() )
@@ -351,6 +361,32 @@
}
/**
+ * Combines the old Collection with the new comma separated list.
+ * @param uncheckedPlugins
+ * @param uncheckedPluginsList
+ * @return
+ */
+ public Collection combineUncheckedPlugins( Collection uncheckedPlugins, String uncheckedPluginsList )
+ {
+ //if the comma list is empty, then there's nothing to do here.
+ if ( StringUtils.isNotEmpty( uncheckedPluginsList ) )
+ {
+ //make sure there is a collection to add to.
+ if ( uncheckedPlugins == null )
+ {
+ uncheckedPlugins = new HashSet();
+ }
+ else if (!uncheckedPlugins.isEmpty() && log != null)
+ {
+ log.warn( "The parameter 'unCheckedPlugins' is deprecated. Use 'unCheckedPluginList' instead" );
+ }
+
+ uncheckedPlugins.addAll( Arrays.asList( uncheckedPluginsList.split( "," ) ) );
+ }
+ return uncheckedPlugins;
+ }
+
+ /**
* Add the additional plugins if they don't exist yet.
*
* @param existing the existing
@@ -399,8 +435,8 @@
if ( pluginStrings.length == 2 )
{
Plugin plugin = new Plugin();
- plugin.setGroupId( pluginStrings[0] );
- plugin.setArtifactId( pluginStrings[1] );
+ plugin.setGroupId( StringUtils.strip( pluginStrings[0] ) );
+ plugin.setArtifactId( StringUtils.strip( pluginStrings[1] ) );
return plugin;
}
diff --git a/enforcer-rules/src/site/apt/requireJavaVersion.apt b/enforcer-rules/src/site/apt/requireJavaVersion.apt
index 30b4737..5817695 100644
--- a/enforcer-rules/src/site/apt/requireJavaVersion.apt
+++ b/enforcer-rules/src/site/apt/requireJavaVersion.apt
@@ -58,7 +58,7 @@
JDK Version: 1.5.0_11 normalized as: 1.5.0-11
OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
+---+
-
+
Sample Plugin Configuration:
+---+
@@ -91,4 +91,5 @@
[...]
</project>
+---+
-
\ No newline at end of file
+
+ If you would like to enforce a certain vendor string for the JDK, you would use the {{{./requireProperty.html}RequireProperty}} rule, and check the java.vendor property with a regular expression.
\ No newline at end of file
diff --git a/enforcer-rules/src/site/apt/requirePluginVersions.apt b/enforcer-rules/src/site/apt/requirePluginVersions.apt
index 81fa7a1..78e27d9 100644
--- a/enforcer-rules/src/site/apt/requirePluginVersions.apt
+++ b/enforcer-rules/src/site/apt/requirePluginVersions.apt
@@ -46,7 +46,7 @@
are plugins that may not be in the poms but are used anyway, like help, eclipse etc.
The plugins should be specified in the form: group:artifactId.
- * unCheckedPlugins - A list of plugins to skip version checking. Ie allow no version, or snapshots, etc. The plugins should be specified in the form: group:artifactId.
+ * unCheckedPluginsList - A comma separated list of plugins to skip version checking. Ie allow no version, or snapshots, etc. The plugins should be specified in the form: group:artifactId.
[]
@@ -78,9 +78,10 @@
<phases>clean,deploy,site</phases>
<additionalPlugins>
<additionalPlugin>org.apache.maven.plugins:maven-eclipse-plugin</additionalPlugin>
- <additionalPlugin>org.apache.maven.plugins:maven-ide-plugin</additionalPlugin>
+ <additionalPlugin>org.apache.maven.plugins:maven-reactor-plugin</additionalPlugin>
</additionalPlugins>
</requirePluginVersions>
+ <unCheckedPluginsList>org.apache.maven.plugins:maven-enforcer-plugin,org.apache.maven.plugins:maven-idea-plugin</unCheckedPluginsList>
</rules>
</configuration>
</execution>
diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequirePluginVersions.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequirePluginVersions.java
index 4449e1a..0997e3c 100644
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequirePluginVersions.java
+++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequirePluginVersions.java
@@ -341,7 +341,8 @@
plugins.add( EnforcerTestUtils.newPlugin( "group", "foo2", "" ) );
List unchecked = new ArrayList();
- unchecked.add( "group:a-artifact" );
+ //intentionally inserting spaces to make sure they are handled correctly.
+ unchecked.add( "group : a-artifact" );
Collection results = rule.removeUncheckedPlugins( unchecked, plugins );
@@ -351,11 +352,132 @@
assertEquals( 2, results.size() );
assertContainsPlugin( "group", "foo", results );
assertContainsPlugin( "group", "foo2", results );
- assertNotContainPlugin( "group", "a-artifact", plugins );
+ assertNotContainPlugin( "group", "a-artifact", results );
}
/**
+ * Test combining values from both lists
+ */
+ public void testCombinePlugins()
+ {
+ RequirePluginVersions rule = new RequirePluginVersions();
+
+ Set plugins = new HashSet();
+ plugins.add( "group:a-artifact" );
+ plugins.add( "group:foo" );
+ plugins.add( "group:foo2" );
+
+ Collection results = rule.combineUncheckedPlugins( plugins, "group2:a,group3:b" );
+
+ // make sure only one new plugin has been added
+ assertNotNull( results );
+ assertEquals( 5, results.size() );
+ assertTrue( results.contains( "group:foo") );
+ assertTrue( results.contains( "group:foo2") );
+ assertTrue( results.contains( "group:a-artifact") );
+ assertTrue( results.contains( "group2:a") );
+ assertTrue( results.contains( "group3:b") );
+ }
+
+ /**
+ * Test combining with an empty list
+ */
+ public void testCombinePlugins1()
+ {
+ RequirePluginVersions rule = new RequirePluginVersions();
+
+ Set plugins = new HashSet();
+ Collection results = rule.combineUncheckedPlugins( plugins, "group2:a,group3:b" );
+
+
+ // make sure only one new plugin has been added
+ assertNotNull( results );
+ assertEquals( 2, results.size() );
+ assertTrue( results.contains( "group2:a") );
+ assertTrue( results.contains( "group3:b") );
+ }
+
+ /**
+ * Test combining with a null list
+ */
+ public void testCombinePlugins2()
+ {
+ RequirePluginVersions rule = new RequirePluginVersions();
+
+ Collection results = rule.combineUncheckedPlugins( null, "group2:a,group3:b" );
+
+
+ // make sure only one new plugin has been added
+ assertNotNull( results );
+ assertEquals( 2, results.size() );
+ assertTrue( results.contains( "group2:a") );
+ assertTrue( results.contains( "group3:b") );
+ }
+
+ /**
+ * Test combining with an empty string
+ */
+ public void testCombinePlugins3()
+ {
+ RequirePluginVersions rule = new RequirePluginVersions();
+
+ Set plugins = new HashSet();
+ plugins.add( "group:a-artifact" );
+ plugins.add( "group:foo" );
+ plugins.add( "group:foo2" );
+
+ Collection results = rule.combineUncheckedPlugins( plugins, "" );
+ assertNotNull( results );
+ assertEquals( 3, results.size() );
+ assertTrue( results.contains( "group:foo") );
+ assertTrue( results.contains( "group:foo2") );
+ assertTrue( results.contains( "group:a-artifact") );
+ }
+
+ /**
+ * Test combining with a null string
+ */
+ public void testCombinePlugins4()
+ {
+ RequirePluginVersions rule = new RequirePluginVersions();
+
+ Set plugins = new HashSet();
+ plugins.add( "group:a-artifact" );
+ plugins.add( "group:foo" );
+ plugins.add( "group:foo2" );
+
+ Collection results = rule.combineUncheckedPlugins( plugins, null );
+ assertNotNull( results );
+ assertEquals( 3, results.size() );
+ assertTrue( results.contains( "group:foo") );
+ assertTrue( results.contains( "group:foo2") );
+ assertTrue( results.contains( "group:a-artifact") );
+ }
+
+ /**
+ * Test combining with an invalid plugin string
+ */
+ public void testCombinePlugins5()
+ {
+ RequirePluginVersions rule = new RequirePluginVersions();
+
+ Set plugins = new HashSet();
+ plugins.add( "group:a-artifact" );
+ plugins.add( "group:foo" );
+ plugins.add( "group:foo2" );
+
+ Collection results = rule.combineUncheckedPlugins( plugins, "a" );
+ assertNotNull( results );
+ assertEquals( 4, results.size() );
+ assertTrue( results.contains( "group:foo") );
+ assertTrue( results.contains( "group:foo2") );
+ //this should be here, the checking of a valid plugin string happens in another method.
+ assertTrue( results.contains( "a") );
+ }
+
+
+ /**
* Assert contains plugin.
*
* @param group the group
diff --git a/maven-enforcer-plugin/pom.xml b/maven-enforcer-plugin/pom.xml
index 0530fef..5d556ed 100644
--- a/maven-enforcer-plugin/pom.xml
+++ b/maven-enforcer-plugin/pom.xml
@@ -20,16 +20,17 @@
-->
<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>
+ <inceptionYear>2007</inceptionYear>
<parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
- <version>2-SNAPSHOT</version>
+ <version>1.0-beta-1</version>
</parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-alpha-5-SNAPSHOT</version>
+ <version>1.0-beta-1</version>
<packaging>maven-plugin</packaging>
<name>Maven Enforcer Plugin</name>
diff --git a/pom.xml b/pom.xml
index 0643c46..83a8589 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
- <version>2-SNAPSHOT</version>
+ <version>1.0-beta-1</version>
<packaging>pom</packaging>
<name>Enforcer</name>
@@ -133,9 +133,9 @@
</modules>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/maven/enforcer/trunk/</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/enforcer/trunk/</developerConnection>
- <url>http://svn.apache.org/viewcvs.cgi/maven/enforcer/trunk</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/enforcer/tags/enforcer-1.0-beta-1</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/enforcer/tags/enforcer-1.0-beta-1</developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/maven/enforcer/tags/enforcer-1.0-beta-1</url>
</scm>
<issueManagement>
<system>jira</system>
@@ -149,8 +149,6 @@
</distributionManagement>
<properties>
- <api.version>1.0-alpha-4-SNAPSHOT</api.version>
- <rules.version>1.0-alpha-4-SNAPSHOT</rules.version>
<maven.version>2.0.9</maven.version>
<maven.plugin.plugin.version>2.4.3</maven.plugin.plugin.version>
<site.deploy.url>scp://people.apache.org/www/maven.apache.org</site.deploy.url>
@@ -161,17 +159,17 @@
<dependency>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer-api</artifactId>
- <version>1.0-alpha-5-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer-rules</artifactId>
- <version>1.0-alpha-5-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer-rules</artifactId>
- <version>1.0-alpha-5-SNAPSHOT</version>
+ <version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
@@ -198,7 +196,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>1.5.1</version>
+ <version>1.5.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>