geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1021296 - /geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
Date Mon, 11 Oct 2010 10:04:23 GMT
Author: genspring
Date: Mon Oct 11 10:04:23 2010
New Revision: 1021296

URL: http://svn.apache.org/viewvc?rev=1021296&view=rev
Log:
GERONIMO-5404 Uninstallation does not remove the installed unique dependencies.

Modified:
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java?rev=1021296&r1=1021295&r2=1021296&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
(original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
Mon Oct 11 10:04:23 2010
@@ -134,6 +134,15 @@ public class PluginMetadataGeneratorMojo
      * @parameter
      */
     private List<Dependency> dependencies = Collections.emptyList();
+    
+    
+    /**
+     * An {@link Dependency} to include as a module of the CAR. we need to exclude this 
+     * from the dependencies since we've included its content in the car directly.
+     *
+     * @parameter
+     */
+    private Dependency module = null;
 
     /**
      * Configuration of use of maven dependencies.  If missing or if value element is false,
use the explicit list in the car-maven-plugin configuration.
@@ -251,10 +260,16 @@ public class PluginMetadataGeneratorMojo
             }
             instance.setModuleId(artifactType);
             addDependencies(instance);
+            
+            //this module is embeded into the car, we don't want to install it as a dependency
again.
+            this.removeIncludedModule(instance.getDependency(), module);
+
+            
             targetDir.mkdirs();
             File targetFile = new File(targetDir.toURI().resolve(pluginMetadataFileName));
             targetFile.getParentFile().mkdirs();
             FileOutputStream out = new FileOutputStream(targetFile);
+
             try {
                 PluginXmlUtil.writePluginMetadata(metadata, out);
             } finally {
@@ -289,5 +304,19 @@ public class PluginMetadataGeneratorMojo
         LinkedHashSet<DependencyType> resolvedDependencies = toDependencies(dependencies,
useMavenDependencies, false);
             instance.getDependency().addAll(resolvedDependencies);
     }
+    
+    private void removeIncludedModule(List<DependencyType> sourceList, Dependency removeTarget)
{
+       
+        for (DependencyType dependencyType : sourceList) {
+            if ((dependencyType.getArtifactId().equals(removeTarget.artifactId))
+                    && (dependencyType.getGroupId().equals(removeTarget.groupId))
+                    && (dependencyType.getType().equals(removeTarget.type))
+                    && (dependencyType.getVersion().equals(removeTarget.version)))
{
+
+                sourceList.remove(dependencyType);
+            }
+        }
+            
+    }
 
 }



Mime
View raw message