You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/05/27 00:43:27 UTC
svn commit: r1342986 -
/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
Author: hboutemy
Date: Sat May 26 22:43:27 2012
New Revision: 1342986
URL: http://svn.apache.org/viewvc?rev=1342986&view=rev
Log:
extracted writeGoal() and writeParameter() methods
Modified:
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
Modified: maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm?rev=1342986&r1=1342985&r2=1342986&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm Sat May 26 22:43:27 2012
@@ -152,54 +152,69 @@ public class HelpMojo
if ( goal == null || goal.length() <= 0 )
{
-
append( sb, "This plugin has " + mojos.length + " goals:", 0 );
append( sb, "", 0 );
}
for ( Xpp3Dom mojo : mojos )
{
- String mojoGoal = mojo.getChild( "goal" ).getValue();
- Xpp3Dom configurationElement = mojo.getChild( "configuration" );
- if ( goal == null || goal.length() <= 0 || mojoGoal.equals( goal ) )
+ writeGoal( sb, goalPrefix, mojo );
+ }
+
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( sb.toString() );
+ }
+ }
+
+ private void writeGoal( StringBuilder sb, String goalPrefix, Xpp3Dom mojo )
+ {
+ String mojoGoal = mojo.getChild( "goal" ).getValue();
+ Xpp3Dom configurationElement = mojo.getChild( "configuration" );
+
+ if ( goal == null || goal.length() <= 0 || mojoGoal.equals( goal ) )
+ {
+ append( sb, goalPrefix + ":" + mojoGoal, 0 );
+ append( sb, mojo.getChild( "description" ).getValue(), 1 );
+ append( sb, "", 0 );
+
+ if ( detail )
{
- append( sb, goalPrefix + ":" + mojoGoal, 0 );
- append( sb, mojo.getChild( "description" ).getValue(), 1 );
+ Xpp3Dom[] parameters = mojo.getChild( "parameters" ).getChildren( "parameter" );
+ append( sb, "Available parameters:", 1 );
append( sb, "", 0 );
- if ( detail )
+
+ append( sb, "goalPrefix", 2 );
+ append( sb, "The prefix for the plugin goal.", 3 );
+ append( sb, "", 0 );
+
+ for ( Xpp3Dom parameter : parameters )
{
- Xpp3Dom[] parameters = mojo.getChild( "parameters" ).getChildren( "parameter" );
- append( sb, "Available parameters:", 1 );
- append( sb, "", 0 );
-
- append( sb, "goalPrefix", 2 );
- append( sb, "The prefix for the plugin goal.", 3 );
- append( sb, "", 0 );
-
- for ( Xpp3Dom parameter : parameters )
- {
- String name = parameter.getChild( "name" ).getValue();
- Xpp3Dom fieldConfigurationElement = configurationElement.getChild( name );
- if ( fieldConfigurationElement != null && fieldConfigurationElement.getValue() != null )
- {
- append( sb, name + " (default: " + configurationElement.getChild( name ).getAttribute( "default-value" ) + ")", 2 );
- }
-
- append( sb, parameter.getChild( "description" ).getValue(), 3 );
- if ( fieldConfigurationElement != null && fieldConfigurationElement.getValue() != null )
- {
- append( sb, fieldConfigurationElement.getValue(), 3 );
- }
- append( sb, "", 0 );
- }
+ writeParameter( sb, parameter, configurationElement );
}
}
}
+ }
- if ( getLog().isInfoEnabled() )
+ private void writeParameter( StringBuilder sb, Xpp3Dom parameter, Xpp3Dom configurationElement )
+ {
+ String name = parameter.getChild( "name" ).getValue();
+
+ Xpp3Dom fieldConfigurationElement = configurationElement.getChild( name );
+
+ if ( fieldConfigurationElement != null && fieldConfigurationElement.getValue() != null )
{
- getLog().info( sb.toString() );
+ append( sb, name + " (default: " + configurationElement.getChild( name ).getAttribute( "default-value" ) + ")", 2 );
}
+
+ append( sb, parameter.getChild( "description" ).getValue(), 3 );
+
+ if ( fieldConfigurationElement != null && fieldConfigurationElement.getValue() != null )
+ {
+ append( sb, fieldConfigurationElement.getValue(), 3 );
+ }
+
+ append( sb, "", 0 );
}
/**