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 10:38:54 UTC

svn commit: r1343014 - /maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java

Author: hboutemy
Date: Sun May 27 08:38:53 2012
New Revision: 1343014

URL: http://svn.apache.org/viewvc?rev=1343014&view=rev
Log:
added comment in generated files to show how+when it was generated

Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java

Modified: maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=1343014&r1=1343013&r2=1343014&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java Sun May 27 08:38:53 2012
@@ -45,6 +45,8 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -118,6 +120,13 @@ public class PluginDescriptorGenerator
         }
     }
 
+    private String getVersion()
+    {
+        Package p = this.getClass().getPackage();
+        String version = ( p == null ) ? null : p.getSpecificationVersion();
+        return ( version == null ) ? "SNAPSHOT" : version;
+    }
+
     public void writeDescriptor( File destinationFile, PluginToolsRequest request, boolean helpDescriptor )
         throws IOException, DuplicateMojoDescriptorException
     {
@@ -144,6 +153,9 @@ public class PluginDescriptorGenerator
 
             XMLWriter w = new PrettyPrintXMLWriter( writer, encoding, null );
 
+            w.writeMarkup( "\n<!-- Generated by maven-plugin-tools " + getVersion() + " on "
+                + new SimpleDateFormat( "yyyy-MM-dd" ).format( new Date() ) + " -->\n\n" );
+
             w.startElement( "plugin" );
 
             GeneratorUtils.element( w, "name", pluginDescriptor.getName() );