You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/11/03 14:55:21 UTC

svn commit: r1405334 - /maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/resources/help-class-source.vm

Author: rfscholte
Date: Sat Nov  3 13:55:21 2012
New Revision: 1405334

URL: http://svn.apache.org/viewvc?rev=1405334&view=rev
Log:
[MPLUGIN-230] sync help-goal with goal-report: Use 'User property' instead of 'Expression' 

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=1405334&r1=1405333&r2=1405334&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 Nov  3 13:55:21 2012
@@ -177,11 +177,11 @@ public class HelpMojo
         List<Node> namedChild = findNamedChild( node, elementName );
         if ( namedChild.isEmpty() )
         {
-            throw new MojoExecutionException( "Could not find " + elementName + "in plugin-help.xml" );
+            throw new MojoExecutionException( "Could not find " + elementName + " in plugin-help.xml" );
         }
         if ( namedChild.size() > 1 )
         {
-            throw new MojoExecutionException( "Multiple " + elementName + "in plugin-help.xml" );
+            throw new MojoExecutionException( "Multiple " + elementName + " in plugin-help.xml" );
         }
         Node node1 = namedChild.get( 0 );
         return node1;
@@ -285,7 +285,8 @@ public class HelpMojo
         Node expression = findSingleChild( parameter, "expression" );
         if ( ( expression != null ) && isNotEmpty( expression.getNodeValue() ) )
         {
-            append( sb, "Expression: " + expression.getNodeValue(), 3 );
+        	String property = getPropertyFromExpression( expression.getNodeValue() );
+            append( sb, "User property: " + property, 3 );
         }
 
         append( sb, "", 0 );
@@ -428,4 +429,16 @@ public class HelpMojo
         }
         return level;
     }
+    
+    private String getPropertyFromExpression( String expression )
+    {
+        if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" )
+            && !expression.substring( 2 ).contains( "${" ) )
+        {
+            // expression="${xxx}" -> property="xxx"
+            return expression.substring( 2, expression.length() - 1 );
+        }
+        // no property can be extracted
+        return null;
+    }
 }