in maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java [1060:1134]
private void checkRequiredParameters( MojoDescriptor goal,
PlexusConfiguration configuration,
ExpressionEvaluator expressionEvaluator )
throws PluginConfigurationException
{
// TODO: this should be built in to the configurator, as we presently double process the expressions
List parameters = goal.getParameters();
if ( parameters == null )
{
return;
}
List invalidParameters = new ArrayList();
for ( int i = 0; i < parameters.size(); i++ )
{
Parameter parameter = (Parameter) parameters.get( i );
if ( parameter.isRequired() )
{
// the key for the configuration map we're building.
String key = parameter.getName();
Object fieldValue = null;
String expression = null;
PlexusConfiguration value = configuration.getChild( key, false );
try
{
if ( value != null )
{
expression = value.getValue( null );
fieldValue = expressionEvaluator.evaluate( expression );
if ( fieldValue == null )
{
fieldValue = value.getAttribute( "default-value", null );
}
}
if ( ( fieldValue == null ) && StringUtils.isNotEmpty( parameter.getAlias() ) )
{
value = configuration.getChild( parameter.getAlias(), false );
if ( value != null )
{
expression = value.getValue( null );
fieldValue = expressionEvaluator.evaluate( expression );
if ( fieldValue == null )
{
fieldValue = value.getAttribute( "default-value", null );
}
}
}
}
catch ( ExpressionEvaluationException e )
{
throw new PluginConfigurationException( goal.getPluginDescriptor(), e.getMessage(), e );
}
// only mark as invalid if there are no child nodes
if ( ( fieldValue == null ) && ( ( value == null ) || ( value.getChildCount() == 0 ) ) )
{
parameter.setExpression( expression );
invalidParameters.add( parameter );
}
}
}
if ( !invalidParameters.isEmpty() )
{
throw new PluginParameterException( goal, invalidParameters );
}
}