maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ken...@apache.org
Subject svn commit: r472170 - /maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
Date Tue, 07 Nov 2006 17:05:49 GMT
Author: kenney
Date: Tue Nov  7 09:05:48 2006
New Revision: 472170

URL: http://svn.apache.org/viewvc?view=rev&rev=472170
Log:
Fix possible ClassCasts for BuildCommands; used portions of patch from MECLIPSE-139 submitted
by Jochen Kuhnle

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?view=diff&rev=472170&r1=472169&r2=472170
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
Tue Nov  7 09:05:48 2006
@@ -22,6 +22,7 @@
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -533,9 +534,14 @@
         {
             fillDefaultBuilders( packaging );
         }
+        else
+        {
+            convertBuildCommandList( buildcommands );
+        }
 
         if ( additionalBuildcommands != null )
         {
+            convertBuildCommandList( additionalBuildcommands );
             buildcommands.addAll( additionalBuildcommands );
         }
 
@@ -553,6 +559,23 @@
         return true;
     }
 
+    protected void convertBuildCommandList( List commands )
+    {
+        if ( commands != null )
+        {
+            for ( ListIterator i = commands.listIterator(); i.hasNext(); )
+            {
+                Object command = i.next();
+
+                if ( command instanceof String )
+                {
+                    command = new BuildCommand( (String) command );
+                    i.set( command );
+                }
+            }
+        }
+    }
+
     public void writeConfiguration( IdeDependency[] deps )
         throws MojoExecutionException
     {
@@ -576,12 +599,7 @@
         //       <somekey>somevalue</somekey>
         //     </arguments>
 
-        List convertedBuildCommands = new ArrayList();
-        for ( Iterator it = buildcommands.iterator(); it.hasNext();)
-        {
-            convertedBuildCommands.add( new BuildCommand( (String) it.next(), null ) );
-        }
-        config.setBuildCommands( convertedBuildCommands );
+        config.setBuildCommands( buildcommands );
         config.setBuildOutputDirectory( buildOutputDirectory );
         config.setClasspathContainers( classpathContainers );
         config.setDeps( deps );
@@ -715,33 +733,33 @@
 
         if ( wtpVersionFloat == 0.7f )
         {
-            buildcommands.add( BUILDER_WST_COMPONENT_STRUCTURAL ); // WTP 0.7 builder
+            buildcommands.add( new BuildCommand( BUILDER_WST_COMPONENT_STRUCTURAL ) ); //
WTP 0.7 builder
         }
 
         if ( isJavaProject )
         {
-            buildcommands.add( BUILDER_JDT_CORE_JAVA );
+            buildcommands.add( new BuildCommand( BUILDER_JDT_CORE_JAVA ) );
         }
 
         if ( wtpVersionFloat >= 1.5f )
         {
-            buildcommands.add( BUILDER_WST_FACET ); // WTP 1.5 builder
+            buildcommands.add( new BuildCommand( BUILDER_WST_FACET ) ); // WTP 1.5 builder
         }
 
         if ( wtpVersionFloat >= 0.7f )
         {
-            buildcommands.add( BUILDER_WST_VALIDATION ); // WTP 0.7/1.0 builder
+            buildcommands.add( new BuildCommand( BUILDER_WST_VALIDATION ) ); // WTP 0.7/1.0
builder
         }
 
         if ( wtpVersionFloat == 0.7f )
         {
-            buildcommands.add( BUILDER_WST_COMPONENT_STRUCTURAL_DEPENDENCY_RESOLVER ); //
WTP 0.7 builder
+            buildcommands.add( new BuildCommand( BUILDER_WST_COMPONENT_STRUCTURAL_DEPENDENCY_RESOLVER
) ); // WTP 0.7 builder
         }
 
         if ( pde )
         {
-            buildcommands.add( BUILDER_PDE_MANIFEST );
-            buildcommands.add( BUILDER_PDE_SCHEMA );
+            buildcommands.add( new BuildCommand( BUILDER_PDE_MANIFEST ) );
+            buildcommands.add( new BuildCommand( BUILDER_PDE_SCHEMA ) );
         }
     }
 



Mime
View raw message