You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ba...@apache.org on 2012/07/04 10:00:44 UTC

svn commit: r1357143 - in /maven/enforcer/trunk: enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/ maven-enforcer-plugin/src/it/require-plugin-versions-plugin-wi...

Author: baerrach
Date: Wed Jul  4 08:00:43 2012
New Revision: 1357143

URL: http://svn.apache.org/viewvc?rev=1357143&view=rev
Log:
[MENFORCER-117] RequirePluginVersions doesn't handle new lifecycles properly

Added:
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/pom.xml   (with props)
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/META-INF/
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/META-INF/MANIFEST.MF   (with props)
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/pom.xml   (with props)
Modified:
    maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java?rev=1357143&r1=1357142&r2=1357143&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java Wed Jul  4 08:00:43 2012
@@ -686,6 +686,8 @@ public class RequirePluginVersions
         throws PluginNotFoundException, LifecycleExecutionException
 
     {
+        log.debug( "RequirePluginVersions.getAllPlugins:" );
+
         Set<Plugin> plugins = new HashSet<Plugin>();
         // first, bind those associated with the packaging
         Map mappings = findMappingsForLifecycle( project, lifecycle );
@@ -694,13 +696,25 @@ public class RequirePluginVersions
         while ( iter.hasNext() )
         {
             Entry entry = (Entry) iter.next();
-            String value = (String) entry.getValue();
-            String tokens[] = value.split( ":" );
-
-            Plugin plugin = new Plugin();
-            plugin.setGroupId( tokens[0] );
-            plugin.setArtifactId( tokens[1] );
-            plugins.add( plugin );
+            log.debug( "  lifecycleMapping = " + entry.getKey() );
+            String pluginsForLifecycle = (String) entry.getValue();
+            log.debug( "  plugins = " + pluginsForLifecycle );
+            if ( StringUtils.isNotEmpty( pluginsForLifecycle ) )
+            {
+                String pluginList[] = pluginsForLifecycle.split( "," );
+                for ( String plugin : pluginList )
+                {
+                    plugin = StringUtils.strip( plugin );
+                    log.debug( "    plugin = " + plugin );
+                    String tokens[] = plugin.split( ":" );
+                    log.debug( "    GAV = " + Arrays.asList( tokens ) );
+
+                    Plugin p = new Plugin();
+                    p.setGroupId( tokens[0] );
+                    p.setArtifactId( tokens[1] );
+                    plugins.add( p );
+                }
+            }
         }
 
         List<String> mojos = findOptionalMojosForLifecycle( project, lifecycle );

Added: maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/pom.xml
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/pom.xml?rev=1357143&view=auto
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/pom.xml (added)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/pom.xml Wed Jul  4 08:00:43 2012
@@ -0,0 +1,74 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>pluginWithExtensions</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>zip</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requirePluginVersions>
+                  <banSnapshots>false</banSnapshots>
+                  <unCheckedPluginList>
+                    org.apache.maven.plugins:maven-clean-plugin,org.apache.maven.plugins:maven-install-plugin,org.apache.maven.plugins:maven-deploy-plugin,org.apache.maven.plugins:maven-site-plugin
+                  </unCheckedPluginList>
+                </requirePluginVersions>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <!-- For http://jira.codehaus.org/browse/MENFORCER-11 This plugin
+          attaches additional lifecycles "generate-sources" which were failed to be
+          handled correctly. -->
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>pde-maven-plugin</artifactId>
+        <version>1.0-alpha-1</version>
+        <extensions>true</extensions>
+        <configuration>
+          <buildProperties>
+            <pdeProductFilename>example.product</pdeProductFilename>
+          </buildProperties>
+        </configuration>
+        <!-- Also bind to mvn clean -->
+        <executions>
+          <execution>
+            <id>clean-pde</id>
+            <phase>clean</phase>
+            <goals>
+              <goal>clean</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.5</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.5.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.12</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-extensions/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/META-INF/MANIFEST.MF?rev=1357143&view=auto
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/META-INF/MANIFEST.MF (added)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/META-INF/MANIFEST.MF Wed Jul  4 08:00:43 2012
@@ -0,0 +1,2 @@
+Bundle-SymbolicName: pluginWithIntegrationTestLifecycle
+Bundle-Version: 1.0.0.qualifier
\ No newline at end of file

Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/pom.xml
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/pom.xml?rev=1357143&view=auto
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/pom.xml (added)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/pom.xml Wed Jul  4 08:00:43 2012
@@ -0,0 +1,74 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>pluginWithIntegrationTestLifecycle</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>eclipse-plugin</packaging>
+  <properties>
+    <tycho-version>0.15.0</tycho-version>
+  </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requirePluginVersions>
+                  <banSnapshots>false</banSnapshots>
+                  <unCheckedPluginList>
+                    org.apache.maven.plugins:maven-clean-plugin,org.apache.maven.plugins:maven-install-plugin,org.apache.maven.plugins:maven-deploy-plugin,org.apache.maven.plugins:maven-site-plugin
+                  </unCheckedPluginList>
+                </requirePluginVersions>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <!-- For http://jira.codehaus.org/browse/MENFORCER-11 This plugin
+          attaches additional lifecycles "integration-test" which were failed to be
+          handled correctly. -->
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-maven-plugin</artifactId>
+        <version>${tycho-version}</version>
+        <extensions>true</extensions>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>target-platform-configuration</artifactId>
+        <version>${tycho-version}</version>
+        <configuration>
+          <!-- recommended: use p2-based target platform resolver -->
+          <resolver>p2</resolver>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-compiler-plugin</artifactId>
+        <version>${tycho-version}</version>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-packaging-plugin</artifactId>
+        <version>${tycho-version}</version>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-p2-plugin</artifactId>
+        <version>${tycho-version}</version>
+      </plugin>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.4.3</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/it/require-plugin-versions-plugin-with-integration-test-lifecycle/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain