update plexus container

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320679 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-13 06:58:22 +00:00
parent 7129bb1b9e
commit f19ade8c85
2 changed files with 42 additions and 70 deletions

View File

@ -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>

View File

@ -19,12 +19,11 @@ package org.apache.maven.plugin.antrun.components;
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;
@ -48,11 +47,9 @@ public class AntTargetConverter
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,19 +62,14 @@ public class AntTargetConverter
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();
@ -89,16 +81,12 @@ public class AntTargetConverter
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();
@ -108,17 +96,11 @@ public class AntTargetConverter
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();
@ -132,9 +114,7 @@ public class AntTargetConverter
target.addTask( task );
}
RuntimeConfigurable wrapper = new RuntimeConfigurable(
task, task.getTaskName()
);
RuntimeConfigurable wrapper = new RuntimeConfigurable( task, task.getTaskName() );
try
{
@ -146,9 +126,7 @@ public class AntTargetConverter
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();
@ -166,11 +144,8 @@ public class AntTargetConverter
}
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 );
@ -178,9 +153,8 @@ public class AntTargetConverter
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 );
}
}
@ -189,19 +163,14 @@ public class AntTargetConverter
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();
}