geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r420691 - in /geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging: PackageBuilder.java PackageBuilderShellMojo.java
Date Tue, 11 Jul 2006 03:35:08 GMT
Author: jdillon
Date: Mon Jul 10 20:35:08 2006
New Revision: 420691

URL: http://svn.apache.org/viewvc?rev=420691&view=rev
Log:
Generate explicit-versions.properties for each config module based on the module's dependencies

Modified:
    geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
    geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java

Modified: geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=420691&r1=420690&r2=420691&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
Mon Jul 10 20:35:08 2006
@@ -318,9 +318,7 @@
     }
 
     public void execute() throws Exception {
-        System.out.println();
-        System.out.println("    Packaging configuration " + planFile);
-        System.out.println();
+        System.out.println("Packaging configuration " + planFile);
 
         try {
             Kernel kernel = createKernel();

Modified: geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java?rev=420691&r1=420690&r2=420691&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java
Mon Jul 10 20:35:08 2006
@@ -18,10 +18,13 @@
 package org.apache.geronimo.plugin.packaging;
 
 import java.io.File;
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 import java.util.Iterator;
+import java.util.Properties;
 
 import org.apache.geronimo.deployment.PluginBootstrap2;
 import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
@@ -138,9 +141,9 @@
     //
     
     /**
-     * @parameter expression="${basedir}/../../etc/explicit_versions.properties"
+     * @parameter expression="${project.build.directory}/explicit-versions.properties"
      */
-    private String explicitResolutionLocation;
+    private File explicitResolutionProperties;
 
     /**
      * @parameter expression="WARN"
@@ -164,19 +167,7 @@
         }
         log.debug("Deployment configs: " + deploymentConfigs);
 
-        //
-        // HACK: Generate explicit_versions for all our dependencies...
-        //
-
-        Set artifacts = getProjectArtifacts();
-        Iterator iter = artifacts.iterator();
-        while (iter.hasNext()) {
-            Artifact artifact = (Artifact)iter.next();
-            log.info(artifact.toString());
-        }
-
-        // ------
-
+        generateExplicitVersionProperties();
 
         if (boot) {
             executeBootShell();
@@ -189,6 +180,27 @@
         project.getArtifact().setFile(packageFile);
     }
 
+    private void generateExplicitVersionProperties() throws IOException {
+        log.debug("Generating explicit version properties: " + explicitResolutionProperties);
+
+        // Generate explicit_versions for all our dependencies...
+        Properties props = new Properties();
+        Iterator iter = getProjectArtifacts().iterator();
+        while (iter.hasNext()) {
+            Artifact artifact = (Artifact)iter.next();
+            String name = artifact.getGroupId() + "/" + artifact.getArtifactId() + "//" +
artifact.getType();
+            String value = artifact.getVersion();
+
+            log.debug("Setting " + name + "=" + value);
+            props.setProperty(name, value);
+        }
+
+        BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(explicitResolutionProperties));
+        props.store(output, "Explicit Versions");
+        output.flush();
+        output.close();
+    }
+
     public void executeBootShell() throws Exception {
         PluginBootstrap2 boot = new PluginBootstrap2();
 
@@ -221,7 +233,7 @@
         builder.setTargetRepository(targetRepository);
         builder.setTargetRepositoryClass(Maven2Repository.class.getName());
         builder.setTargetConfigurationStoreClass(RepositoryConfigurationStore.class.getName());
-        builder.setExplicitResolutionLocation(explicitResolutionLocation);
+        builder.setExplicitResolutionLocation(explicitResolutionProperties.getAbsolutePath());
         builder.setLogLevel(logLevel);
 
         builder.execute();



Mime
View raw message