You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/07/11 21:50:00 UTC

svn commit: r676060 - /maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java

Author: bentmann
Date: Fri Jul 11 12:49:59 2008
New Revision: 676060

URL: http://svn.apache.org/viewvc?rev=676060&view=rev
Log:
[MPLUGIN-125] Add deprecation messages to output of help mojo

Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java

Modified: maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java?rev=676060&r1=676059&r2=676060&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java Fri Jul 11 12:49:59 2008
@@ -417,12 +417,27 @@
     private static void writeGoal( Writer writer, MojoDescriptor descriptor )
         throws IOException
     {
+        String goalDescription = toDescription( descriptor.getDescription() );
+
         writer.write( "        if ( goal == null || goal.length() <= 0 || \""
             + StringUtils.escape( descriptor.getGoal() ) + "\".equals( goal ) )" + LS );
         writer.write( "        {" + LS );
         writer.write( "            append( sb, \"" + StringUtils.escape( descriptor.getFullGoalName() ) + "\", 0 );"
             + LS );
-        writer.write( "            append( sb, \"" + toDescription( descriptor.getDescription() ) + "\", 1 );" + LS );
+        if ( StringUtils.isNotEmpty( descriptor.getDeprecated() ) )
+        {
+            writer.write( "            append( sb, \"Deprecated. " + toDescription( descriptor.getDeprecated() )
+                + "\", 1 );" + LS );
+            writer.write( "            if ( detail )" + LS );
+            writer.write( "            {" + LS );
+            writer.write( "                append( sb, \"\", 0 );" + LS );
+            writer.write( "                append( sb, \"" + goalDescription + "\", 1 );" + LS );
+            writer.write( "            }" + LS );
+        }
+        else
+        {
+            writer.write( "            append( sb, \"" + goalDescription + "\", 1 );" + LS );
+        }
         writer.write( "            append( sb, \"\", 0 );" + LS );
 
         if ( descriptor.getParameters() != null && descriptor.getParameters().size() > 0 )
@@ -465,6 +480,12 @@
                     + StringUtils.escape( parameter.getDefaultValue() ) + ")" : "" );
 
             writer.write( "                append( sb, \"" + parameterDefaultValue + "\", 2 );" + LS );
+            if ( StringUtils.isNotEmpty( parameter.getDeprecated() ) )
+            {
+                writer.write( "                append( sb, \"Deprecated. " + toDescription( parameter.getDeprecated() )
+                    + "\", 3 );" + LS );
+                writer.write( "                append( sb, \"\", 0 );" + LS );
+            }
             writer.write( "                append( sb, \"" + parameterDescription + "\", 3 );" + LS );
             writer.write( "                append( sb, \"\", 0 );" + LS );
         }