[MPLUGIN-178] Generated help mojo should indicate parameter expression and required status

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1050544 13f79535-47bb-0310-9956-ffa450edef68
master
Benjamin Bentmann 2010-12-18 00:18:09 +00:00
parent 629ed1299a
commit 9ea26413d9
2 changed files with 16 additions and 5 deletions

View File

@ -33,6 +33,7 @@ public class MyMojo
/**
* @parameter expression="${test.undocumented}"
* @required
*/
private String undocumentedParam;

View File

@ -582,11 +582,12 @@ public class PluginHelpGenerator
{
String parameterName = StringUtils.escape( parameter.getName() );
String parameterDescription = toDescription( parameter.getDescription() );
String parameterDefaultValue = parameterName
+ ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) ? " (Default: "
+ StringUtils.escape( parameter.getDefaultValue() ) + ")" : "" );
writer.write( " append( sb, \"" + parameterDefaultValue + "\", 2 );" + LS );
String parameterDefaultValue = "";
if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) )
{
parameterDefaultValue = " (Default: " + StringUtils.escape( parameter.getDefaultValue() ) + ")";
}
writer.write( " append( sb, \"" + parameterName + parameterDefaultValue + "\", 2 );" + LS );
if ( StringUtils.isNotEmpty( parameter.getDeprecated() ) )
{
writer.write( " append( sb, \"Deprecated. " + toDescription( parameter.getDeprecated() )
@ -594,6 +595,15 @@ public class PluginHelpGenerator
writer.write( " append( sb, \"\", 0 );" + LS );
}
writer.write( " append( sb, \"" + parameterDescription + "\", 3 );" + LS );
if ( parameter.isRequired() )
{
writer.write( " append( sb, \"Required: Yes\", 3 );" + LS );
}
if ( StringUtils.isNotEmpty( parameter.getExpression() ) )
{
writer.write( " append( sb, \"Expression: "
+ StringUtils.escape( parameter.getExpression() ) + "\", 3 );" + LS );
}
writer.write( " append( sb, \"\", 0 );" + LS );
}
}