[MNG-4941] PluginDescriptorBuilder doesn't populate expression/default-value fields for mojo parameters

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1050531 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-12-17 23:44:13 +00:00
parent b0e468190e
commit c40029459a
2 changed files with 16 additions and 9 deletions

View File

@ -254,6 +254,13 @@ public class PluginDescriptorBuilder
mojo.setThreadSafe( Boolean.parseBoolean( threadSafe ) ); mojo.setThreadSafe( Boolean.parseBoolean( threadSafe ) );
} }
// ----------------------------------------------------------------------
// Configuration
// ----------------------------------------------------------------------
PlexusConfiguration mojoConfig = c.getChild( "configuration" );
mojo.setMojoConfiguration( mojoConfig );
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Parameters // Parameters
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -292,6 +299,13 @@ public class PluginDescriptorBuilder
parameter.setImplementation( d.getChild( "implementation" ).getValue() ); parameter.setImplementation( d.getChild( "implementation" ).getValue() );
PlexusConfiguration paramConfig = mojoConfig.getChild( parameter.getName(), false );
if ( paramConfig != null )
{
parameter.setExpression( paramConfig.getValue( null ) );
parameter.setDefaultValue( paramConfig.getAttribute( "default-value" ) );
}
parameters.add( parameter ); parameters.add( parameter );
} }
@ -299,15 +313,6 @@ public class PluginDescriptorBuilder
// TODO: this should not need to be handed off... // TODO: this should not need to be handed off...
// ----------------------------------------------------------------------
// Configuration
// ----------------------------------------------------------------------
mojo.setMojoConfiguration( c.getChild( "configuration" ) );
// TODO: Go back to this when we get the container ready to configure mojos...
// mojo.setConfiguration( c.getChild( "configuration" ) );
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Requirements // Requirements
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------

View File

@ -105,6 +105,8 @@ public class PluginDescriptorBuilderTest
assertEquals( false, mp.isRequired() ); assertEquals( false, mp.isRequired() );
assertEquals( "parameter-description", mp.getDescription() ); assertEquals( "parameter-description", mp.getDescription() );
assertEquals( "deprecated-parameter", mp.getDeprecated() ); assertEquals( "deprecated-parameter", mp.getDeprecated() );
assertEquals( "${jar.finalName}", mp.getExpression() );
assertEquals( "${project.build.finalName}", mp.getDefaultValue() );
ComponentRequirement cr = md.getRequirements().get( 0 ); ComponentRequirement cr = md.getRequirements().get( 0 );