You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/13 08:58:31 UTC

svn commit: r320679 - in /maven/components/trunk/maven-plugins/maven-antrun-plugin: pom.xml src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java

Author: brett
Date: Wed Oct 12 23:58:22 2005
New Revision: 320679

URL: http://svn.apache.org/viewcvs?rev=320679&view=rev
Log:
update plexus container

Modified:
    maven/components/trunk/maven-plugins/maven-antrun-plugin/pom.xml
    maven/components/trunk/maven-plugins/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java

Modified: maven/components/trunk/maven-plugins/maven-antrun-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-antrun-plugin/pom.xml?rev=320679&r1=320678&r2=320679&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-antrun-plugin/pom.xml (original)
+++ maven/components/trunk/maven-plugins/maven-antrun-plugin/pom.xml Wed Oct 12 23:58:22 2005
@@ -2,7 +2,7 @@
   <parent>
     <artifactId>maven-plugin-parent</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
-    <version>2.0-beta-3</version>
+    <version>2.0-beta-4-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>maven-antrun-plugin</artifactId>
@@ -10,6 +10,9 @@
   <name>Maven AntRun Plugin</name>
   <version>1.0-rc2-SNAPSHOT</version>
   <description>Runs ant scripts embedded in the POM</description>
+  <prerequisites>
+    <maven>2.0-beta-4-SNAPSHOT</maven>
+  </prerequisites>
   <developers>
     <developer>
       <id>kenney</id>

Modified: maven/components/trunk/maven-plugins/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java?rev=320679&r1=320678&r2=320679&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java (original)
+++ maven/components/trunk/maven-plugins/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java Wed Oct 12 23:58:22 2005
@@ -19,12 +19,11 @@
 import org.apache.tools.ant.ComponentHelper;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.ProjectHelper;
-import org.apache.tools.ant.Project;
 import org.apache.tools.ant.RuntimeConfigurable;
 import org.apache.tools.ant.Target;
 import org.apache.tools.ant.UnknownElement;
-
 import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
+import org.codehaus.plexus.component.configurator.ConfigurationListener;
 import org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter;
 import org.codehaus.plexus.component.configurator.converters.ConfigurationConverter;
 import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
@@ -35,7 +34,7 @@
 
 /**
  * Plexus ConfigurationConverter to set up Ant Target component fields.
- * 
+ *
  * @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
  */
 public class AntTargetConverter
@@ -48,11 +47,9 @@
         return Target.class.isAssignableFrom( type );
     }
 
-    public Object fromConfiguration(
-        ConverterLookup converterLookup, PlexusConfiguration configuration,
-        Class type, Class baseType, ClassLoader classLoader,
-        ExpressionEvaluator expressionEvaluator
-    )
+    public Object fromConfiguration( ConverterLookup converterLookup, PlexusConfiguration configuration, Class type,
+                                     Class baseType, ClassLoader classLoader, ExpressionEvaluator expressionEvaluator,
+                                     ConfigurationListener listener )
         throws ComponentConfigurationException
     {
         Object retValue = fromExpression( configuration, expressionEvaluator, type );
@@ -65,64 +62,49 @@
 
         retValue = instantiateObject( implementation );
 
-        processConfiguration(
-            (Target) retValue, classLoader, configuration, expressionEvaluator
-        );
+        processConfiguration( (Target) retValue, configuration, expressionEvaluator );
 
         return retValue;
     }
 
 
-    private void processConfiguration(
-        Target target, ClassLoader classLoader,
-        PlexusConfiguration configuration,
-        ExpressionEvaluator expressionEvaluator
-    )
+    private void processConfiguration( Target target, PlexusConfiguration configuration,
+                                       ExpressionEvaluator expressionEvaluator )
         throws ComponentConfigurationException
     {
         Project project = new Project();
         project.setName( "DummyProject" );
-        
+
         target.setName( "" );
         target.setProject( project );
         project.addTarget( target );
-        
+
         initDefinitions( project, target );
-        
-        processConfiguration(
-            null, project, target, configuration, expressionEvaluator
-        );
+
+        processConfiguration( null, project, target, configuration, expressionEvaluator );
     }
 
-        
-    private void processConfiguration(
-        RuntimeConfigurable parentWrapper, Project project, Target target,
-        PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator
-    )
+
+    private void processConfiguration( RuntimeConfigurable parentWrapper, Project project, Target target,
+                                       PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator )
         throws ComponentConfigurationException
     {
         int items = configuration.getChildCount();
-    
+
         Object parent = parentWrapper == null ? null : parentWrapper.getProxy();
-        
+
         for ( int i = 0; i < items; i++ )
-        {			
+        {
             PlexusConfiguration childConfiguration = configuration.getChild( i );
-            UnknownElement task = new UnknownElement(
-                childConfiguration.getName()
-            );
+            UnknownElement task = new UnknownElement( childConfiguration.getName() );
             task.setProject( project );
             task.setNamespace( "" );
             task.setQName( childConfiguration.getName() );
-            task.setTaskType(
-                ProjectHelper.genComponentName(
-                    task.getNamespace(), childConfiguration.getName()
-                    )
-            );
+            task.setTaskType( ProjectHelper.genComponentName( task.getNamespace(), childConfiguration.getName() ) );
             task.setTaskName( childConfiguration.getName() );
             task.setOwningTarget( target );
             task.init();
-            
+
             if ( parent != null )
             {
                 ( (UnknownElement) parent ).addChild( task );
@@ -131,11 +113,9 @@
             {
                 target.addTask( task );
             }
-            
-            RuntimeConfigurable wrapper = new RuntimeConfigurable(
-                task, task.getTaskName()
-            );
-    
+
+            RuntimeConfigurable wrapper = new RuntimeConfigurable( task, task.getTaskName() );
+
             try
             {
                 if ( childConfiguration.getValue() != null )
@@ -146,11 +126,9 @@
             catch ( PlexusConfigurationException e )
             {
                 throw new ComponentConfigurationException(
-                    "Error reading text value from element '" +
-                    childConfiguration.getName() + "'", e
-                );
+                    "Error reading text value from element '" + childConfiguration.getName() + "'", e );
             }
-            
+
             String [] attrNames = childConfiguration.getAttributeNames();
 
             for ( int a = 0; a < attrNames.length; a++ )
@@ -158,7 +136,7 @@
                 try
                 {
                     String v = childConfiguration.getAttribute( attrNames[a] );
-                    
+
                     try
                     {
                         Object evaluatedExpr = expressionEvaluator.evaluate( v );
@@ -166,42 +144,33 @@
                     }
                     catch ( ExpressionEvaluationException e )
                     {
-                        throw new ComponentConfigurationException
-                        (
-                            "Error evaluating value '" + v + "' of attribute '" + attrNames[a] + 
-                            "' of tag '" + childConfiguration.getName() + "'", e
-                        );
+                        throw new ComponentConfigurationException( "Error evaluating value '" + v + "' of attribute '" +
+                            attrNames[a] + "' of tag '" + childConfiguration.getName() + "'", e );
                     }
-                    
+
                     wrapper.setAttribute( attrNames[a], v );
                 }
                 catch ( PlexusConfigurationException e )
                 {
                     throw new ComponentConfigurationException(
-                        "Error getting attribute '" + attrNames[a] + 
-                        "' of tag '" + childConfiguration.getName() + "'", e
-                    );
+                        "Error getting attribute '" + attrNames[a] + "' of tag '" + childConfiguration.getName() + "'",
+                        e );
                 }
             }
-            
+
             if ( parentWrapper != null )
             {
                 parentWrapper.addChild( wrapper );
             }
-            
-            processConfiguration(
-                wrapper, project, target,
-                childConfiguration, expressionEvaluator
-            );
+
+            processConfiguration( wrapper, project, target, childConfiguration, expressionEvaluator );
         }
     }
-    
-    
+
+
     protected void initDefinitions( Project project, Target target )
     {
-        ComponentHelper componentHelper = ComponentHelper.getComponentHelper(
-            project
-        );
+        ComponentHelper componentHelper = ComponentHelper.getComponentHelper( project );
 
         componentHelper.initDefaultDefinitions();
     }