maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r683377 - /maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
Date Wed, 06 Aug 2008 19:06:38 GMT
Author: vsiveton
Date: Wed Aug  6 12:06:37 2008
New Revision: 683377

URL: http://svn.apache.org/viewvc?rev=683377&view=rev
Log:
o improved the generated class Javadoc and added @author tag

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=683377&r1=683376&r2=683377&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
Wed Aug  6 12:06:37 2008
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Date;
@@ -29,6 +30,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
@@ -149,7 +151,7 @@
         }
 
         descriptor.setDescription( "Display help information on " + pluginDescriptor.getArtifactId()
-            + ". Call <pre>  mvn " + descriptor.getFullGoalName()
+            + ".\n * <br/>\n * Call <pre>  mvn " + descriptor.getFullGoalName()
             + " -Ddetail=true -Dgoal=&lt;goal-name&gt;</pre> to display parameter
details." );
 
         try
@@ -309,10 +311,32 @@
                                           MojoDescriptor helpDescriptor )
         throws IOException
     {
+        StringBuffer author = new StringBuffer();
+        author.append( PluginHelpGenerator.class.getName() );
+
+        String resource = "META-INF/maven/org.apache.maven.plugin-tools/maven-plugin-tools-api/pom.properties";
+        InputStream resourceAsStream = PluginHelpGenerator.class.getClassLoader().getResourceAsStream(
resource );
+
+        if ( resourceAsStream != null )
+        {
+            try
+            {
+                Properties properties = new Properties();
+                properties.load( resourceAsStream );
+
+                author.append( " (version " ).append( properties.getProperty( "version",
"unknown" ) ).append( ")" );
+            }
+            catch ( IOException e )
+            {
+                // nope
+            }
+        }
+
         writer.write( "/**" + LS );
         writer.write( " * " + helpDescriptor.getDescription() + LS );
         writer.write( " *" + LS );
         writer.write( " * @version generated on " + new Date() + LS );
+        writer.write( " * @author " + author.toString() + LS );
         writer.write( " * @goal " + helpDescriptor.getGoal() + LS );
         writer.write( " * @requiresProject false" + LS );
         writer.write( " */" + LS );



Mime
View raw message