allow default values for parameters

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163277 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-12-28 20:04:35 +00:00
parent 107aa56cc5
commit 6ed59fe6b7
3 changed files with 24 additions and 37 deletions

View File

@ -152,6 +152,8 @@ public class PluginDescriptorGenerator
element( w, "description", parameter.getDescription() );
element( w, "defaultValue", parameter.getDescription() );
w.endElement();
}
@ -200,33 +202,6 @@ public class PluginDescriptorGenerator
}
}
/*
// ----------------------------------------------------------------------
Xpp3Dom parent = pomDom.getChild( "parent" );
if ( parent != null )
{
String groupId = parent.getChild( "groupId" ).getValue();
System.out.println( "groupId = " + groupId );
String artifactId = parent.getChild( "artifactId" ).getValue();
System.out.println( "artifactId = " + artifactId );
String version = parent.getChild( "version" ).getValue();
System.out.println( "version = " + version );
writeDependencyElement( parent, w );
}
// ----------------------------------------------------------------------
*/
w.endElement();
}

View File

@ -34,6 +34,8 @@ public class Parameter
private String expression;
private String defaultValue;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@ -97,4 +99,14 @@ public class Parameter
{
this.expression = expression;
}
public String getDefaultValue()
{
return defaultValue;
}
public void setDefaultValue( String defaultValue )
{
this.defaultValue = defaultValue;
}
}

View File

@ -12,8 +12,6 @@ import java.util.List;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
* @todo these are all really tools for dealing with xml configurations so they
* should be packaged as such.
*/
public class PluginDescriptorBuilder
{
@ -105,26 +103,28 @@ public class PluginDescriptorBuilder
{
PlexusConfiguration d = parameterConfigurations[i];
Parameter cd = new Parameter();
Parameter parameter = new Parameter();
cd.setName( d.getChild( "name" ).getValue() );
parameter.setName( d.getChild( "name" ).getValue() );
cd.setType( d.getChild( "type" ).getValue() );
parameter.setType( d.getChild( "type" ).getValue() );
String s = c.getChild( "required" ).getValue();
if ( s != null )
{
cd.setRequired( s.equals( "true" ) ? true : false );
parameter.setRequired( s.equals( "true" ) ? true : false );
}
cd.setValidator( d.getChild( "validator" ).getValue() );
parameter.setValidator( d.getChild( "validator" ).getValue() );
cd.setDescription( d.getChild( "description" ).getValue() );
parameter.setDescription( d.getChild( "description" ).getValue() );
cd.setExpression( d.getChild( "expression" ).getValue() );
parameter.setExpression( d.getChild( "expression" ).getValue() );
parameters.add( cd );
parameter.setDefaultValue( d.getChild( "default" ).getValue() );
parameters.add( parameter );
}
mojo.setParameters( parameters );