geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r607675 - /geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
Date Mon, 31 Dec 2007 05:20:36 GMT
Author: djencks
Date: Sun Dec 30 21:20:35 2007
New Revision: 607675

URL: http://svn.apache.org/viewvc?rev=607675&view=rev
Log:
GERONIMO-3724 car-maven-plugin needs to ignore scope when computing visible artifacts in local
maven repo.  Also use the new RecordingLifecycleMonitor

Modified:
    geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java

Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java?rev=607675&r1=607674&r2=607675&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
(original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
Sun Dec 30 21:20:35 2007
@@ -21,17 +21,14 @@
 
 import java.io.File;
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
-import org.codehaus.mojo.pluginsupport.util.ArtifactItem;
-import org.codehaus.mojo.pluginsupport.dependency.DependencyTree;
-
 import org.apache.geronimo.deployment.PluginBootstrap2;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -46,6 +43,8 @@
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.KernelConfigurationManager;
+import org.apache.geronimo.kernel.config.LifecycleException;
+import org.apache.geronimo.kernel.config.RecordingLifecycleMonitor;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
@@ -55,8 +54,11 @@
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.archiver.MavenArchiver;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.mojo.pluginsupport.dependency.DependencyTree;
+import org.codehaus.mojo.pluginsupport.util.ArtifactItem;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -71,6 +73,14 @@
 public class PackageMojo
     extends AbstractCarMojo
 {
+
+    /**
+     * @component
+     * @required
+     * @readonly
+     */
+    private ArtifactFactory artifactFactory;
+
     /**
      * The maven archive configuration to use.
      *
@@ -292,7 +302,26 @@
             moduleFile = artifact.getFile();
             log.debug("Using module file: " + moduleFile);
         }
-        dependencies.setRootNode(dependencyHelper.getDependencies(project).getRootNode());
+
+        MavenProject depsProject = new MavenProject(project);
+        List<org.apache.maven.model.Dependency> projectDeps = new ArrayList<org.apache.maven.model.Dependency>();
+        for (org.apache.maven.model.Dependency dep: (List<org.apache.maven.model.Dependency>)project.getDependencies())
{
+            org.apache.maven.model.Dependency newDep = new org.apache.maven.model.Dependency();
+            newDep.setArtifactId(dep.getArtifactId());
+            newDep.setGroupId(dep.getGroupId());
+            newDep.setClassifier(dep.getClassifier());
+            newDep.setExclusions(dep.getExclusions());
+            newDep.setOptional(dep.isOptional());
+            newDep.setSystemPath(dep.getSystemPath());
+            newDep.setType(dep.getType());
+            newDep.setVersion(dep.getVersion());
+ // don't copy scope
+
+            projectDeps.add(newDep);
+        }
+        depsProject.setDependencies(projectDeps);
+        depsProject.setDependencyArtifacts(depsProject.createArtifacts(artifactFactory, null,
null));
+        dependencies.setRootNode(dependencyHelper.getDependencies(depsProject).getRootNode());
 
         generateExplicitVersionProperties(explicitResolutionProperties, dependencies);
 
@@ -486,8 +515,18 @@
                 org.apache.geronimo.kernel.repository.Artifact configName =
                         org.apache.geronimo.kernel.repository.Artifact.create(artifactName);
                 if (!configurationManager.isLoaded(configName)) {
-                    configurationManager.loadConfiguration(configName);
-                    configurationManager.startConfiguration(configName);
+                    RecordingLifecycleMonitor monitor = new RecordingLifecycleMonitor();
+                    try {
+                        configurationManager.loadConfiguration(configName, monitor);
+                    } catch (LifecycleException e) {
+                        log.error("Could not load deployer configuration: " + configName
+ "\n" + monitor.toString(), e);
+                    }
+                    monitor = new RecordingLifecycleMonitor();
+                    try {
+                        configurationManager.startConfiguration(configName, monitor);
+                    } catch (LifecycleException e) {
+                        log.error("Could not start deployer configuration: " + configName
+ "\n" + monitor.toString(), e);
+                    }
                 }
             }
         } finally {



Mime
View raw message