servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r579052 - /incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateDependsFileMojo.java
Date Tue, 25 Sep 2007 04:17:03 GMT
Author: jstrachan
Date: Mon Sep 24 21:17:01 2007
New Revision: 579052

URL: http://svn.apache.org/viewvc?rev=579052&view=rev
Log:
tidied up the jbi plugin so that the dependency file thats generated comes out using a nicer
formatting; along with including the version information of the current project

Modified:
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateDependsFileMojo.java

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateDependsFileMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateDependsFileMojo.java?rev=579052&r1=579051&r2=579052&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateDependsFileMojo.java
(original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateDependsFileMojo.java
Mon Sep 24 21:17:01 2007
@@ -20,8 +20,9 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Date;
 import java.util.Iterator;
-import java.util.Properties;
 
 import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -43,7 +44,7 @@
     /**
      * The file to generate
      *
-     * @parameter default-value="${project.build.directory}/target/classes/META-INF/maven/dependencies.properties"
+     * @parameter default-value="${project.build.directory}/classes/META-INF/maven/dependencies.properties"
      */
     
     private File outputFile;
@@ -52,11 +53,9 @@
         OutputStream out = null;
         try {
             outputFile.getParentFile().mkdirs();
-            Properties properties = new Properties();
-            populateProperties(properties);
-            String comments = "Generated Maven dependencies by the ServiceMix Maven Plugin";
             out = new FileOutputStream(outputFile);
-            properties.store(out, comments);
+            PrintStream printer = new PrintStream(out);
+            populateProperties(printer);
             getLog().info("Created: " + outputFile);
 
         } catch (Exception e) {
@@ -73,16 +72,33 @@
         }
     }
 
-    protected void populateProperties(Properties properties) {
+    protected void populateProperties(PrintStream out) {
+        out.println("# Project dependencies generated by the Apache ServiceMix Maven Plugin");
+        out.println("# Generated at: " + new Date());
+        out.println();
+
+        out.println("groupId = " + project.getGroupId());
+        out.println("artifactId = " + project.getArtifactId());
+        out.println("version = " + project.getVersion());
+        out.println(project.getGroupId() + SEPARATOR + project.getArtifactId() + SEPARATOR
+ "version = " + project.getVersion());
+        out.println();
+        out.println("# dependencies");
+        out.println();
+
         Iterator iterator = project.getDependencies().iterator();
         while (iterator.hasNext()) {
             Dependency dependency = (Dependency) iterator.next();
             String prefix = dependency.getGroupId() + SEPARATOR + dependency.getArtifactId()
+ SEPARATOR;
-            properties.put(prefix + "version", dependency.getVersion());
-            properties.put(prefix + "type", dependency.getType());
-            properties.put(prefix + "scope", dependency.getScope());
+            out.println(prefix + "version = " + dependency.getVersion());
+            String classifier = dependency.getClassifier();
+            if (classifier != null) {
+                out.println(prefix + "classifier = " + classifier);
+            }
+            out.println(prefix + "type = " + dependency.getType());
+            out.println(prefix + "scope = " + dependency.getScope());
+            out.println();
 
-            getLog().debug("Dependency: " + dependency + " classifier: " + dependency.getClassifier()
+ " type: " + dependency.getType());
+            getLog().debug("Dependency: " + dependency + " classifier: " + classifier + "
type: " + dependency.getType());
         }
     }
 }



Mime
View raw message