You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by js...@apache.org on 2007/09/25 06:17:03 UTC

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

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());
         }
     }
 }