You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ev...@apache.org on 2005/06/27 19:22:56 UTC

svn commit: r202010 - /maven/components/trunk/maven-mboot2/src/main/java/MBoot.java

Author: evenisse
Date: Mon Jun 27 10:22:54 2005
New Revision: 202010

URL: http://svn.apache.org/viewcvs?rev=202010&view=rev
Log:
[MNG-533]. Add pom.properties in generated artifact.

Modified:
    maven/components/trunk/maven-mboot2/src/main/java/MBoot.java

Modified: maven/components/trunk/maven-mboot2/src/main/java/MBoot.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-mboot2/src/main/java/MBoot.java?rev=202010&r1=202009&r2=202010&view=diff
==============================================================================
--- maven/components/trunk/maven-mboot2/src/main/java/MBoot.java (original)
+++ maven/components/trunk/maven-mboot2/src/main/java/MBoot.java Mon Jun 27 10:22:54 2005
@@ -17,8 +17,10 @@
 
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.StringReader;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -30,6 +32,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.TreeMap;
 
 public class MBoot
@@ -729,6 +732,32 @@
 
         String version = reader.getVersion();
 
+        // ----------------------------------------------------------------------
+        // Create pom.properties file
+        // ----------------------------------------------------------------------
+
+        Properties p = new Properties();
+
+        p.setProperty( "groupId", reader.getGroupId() );
+
+        p.setProperty( "artifactId", reader.getArtifactId() );
+
+        p.setProperty( "version", reader.getVersion() );
+
+        File pomPropertiesDir = new File( new File( classes ),
+                                          "META-INF/maven/" + reader.getGroupId() + "/" + reader.getArtifactId() );
+
+        pomPropertiesDir.mkdirs();
+
+        File pomPropertiesFile = new File( pomPropertiesDir, "pom.properties" );
+
+        OutputStream os = new FileOutputStream( pomPropertiesFile );
+
+        p.store( os, "Generated by Maven" );
+
+        os.close(); // stream is flushed but not closed by Properties.store()
+
+        //TODO: Add pom.xml
         jarMojo.execute( new File( classes ), buildDir, artifactId + "-" + version );
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org