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 2014/04/27 15:32:42 UTC

svn commit: r1590390 - in /maven/plugin-tools/trunk: maven-plugin-plugin/src/it/help-basic/expected-help.txt maven-plugin-tools-generators/src/main/resources/help-class-source.vm

Author: hboutemy
Date: Sun Apr 27 13:32:42 2014
New Revision: 1590390

URL: http://svn.apache.org/r1590390
Log:
[MPLUGIN-262] generated HelpMojo doesn't display default values and user properties.
Submitted by: Slawomir Jaranowski
applied with format fixes and check of expected output

Modified:
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/help-basic/expected-help.txt
    maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm

Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/help-basic/expected-help.txt
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/help-basic/expected-help.txt?rev=1590390&r1=1590389&r2=1590390&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/help-basic/expected-help.txt (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/help-basic/expected-help.txt Sun Apr 27 13:32:42 2014
@@ -8,13 +8,16 @@ help:test
 
   Available parameters:
 
-    defaultParam
+    defaultParam (Default: escape\backslash)
       This parameter uses 'quotation' marks and backslashes '\\' in its
       description. Those characters must be escaped in Java string literals.
 
     deprecatedParam
+      Deprecated. As of version 1.0, use the {@link #defaultParam} instead.
+
       This parameter is deprecated.
 
     undocumentedParam
       
       Required: Yes
+      User property: test.undocumented

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=1590390&r1=1590389&r2=1590390&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 Sun Apr 27 13:32:42 2014
@@ -38,7 +38,6 @@ import javax.xml.parsers.ParserConfigura
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -319,18 +318,18 @@ public class HelpMojo
         String parameterName = getValue( parameter, "name" );
         String parameterDescription = getValue( parameter, "description" );
 
-        Node fieldConfigurationElement = findSingleChild( configurationElement, parameterName );
+        Element fieldConfigurationElement = (Element)findSingleChild( configurationElement, parameterName );
 
         String parameterDefaultValue = "";
-        if ( fieldConfigurationElement != null && fieldConfigurationElement.getNodeValue() != null )
+        if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) )
         {
-            parameterDefaultValue = " (Default: " + ((Element)fieldConfigurationElement).getAttribute( "default-value" ) + ")";
+            parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute( "default-value" ) + ")";
         }
         append( sb, parameterName + parameterDefaultValue, 2 );
         Node deprecated = findSingleChild( parameter, "deprecated" );
-        if ( ( deprecated != null ) && isNotEmpty( deprecated.getNodeValue() ) )
+        if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) )
         {
-            append( sb, "Deprecated. " + deprecated.getNodeValue(), 3 );
+            append( sb, "Deprecated. " + deprecated.getTextContent(), 3 );
             append( sb, "", 0 );
         }
         append( sb, parameterDescription, 3 );
@@ -338,10 +337,9 @@ public class HelpMojo
         {
             append( sb, "Required: Yes", 3 );
         }
-        Node expression = findSingleChild( parameter, "expression" );
-        if ( ( expression != null ) && isNotEmpty( expression.getNodeValue() ) )
+        if ( ( fieldConfigurationElement != null ) && isNotEmpty( fieldConfigurationElement.getTextContent() ) )
         {
-        	String property = getPropertyFromExpression( expression.getNodeValue() );
+        	String property = getPropertyFromExpression( fieldConfigurationElement.getTextContent() );
             append( sb, "User property: " + property, 3 );
         }