geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r480326 [2/2] - in /geronimo/server/trunk: configs/activemq/ configs/axis-deployer/ configs/ca-helper-jetty/ configs/ca-helper-tomcat/ configs/client-corba-yoko/ configs/client-deployer/ configs/client-security/ configs/connector-deployer/ ...
Date Wed, 29 Nov 2006 01:48:09 GMT
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?view=diff&rev=480326&r1=480325&r2=480326
==============================================================================
--- 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
Tue Nov 28 17:48:06 2006
@@ -36,6 +36,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.genesis.util.ArtifactItem;
+import org.apache.geronimo.genesis.dependency.DependencyTree;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.KernelRegistry;
@@ -248,11 +249,23 @@
         //       local repository to perform deployment.  If the deployer modules (or their
dependencies)
         //       are missing from the source respository, then strange packaging failures
will occur.
         //
+        Set additionalArtifacts = new HashSet();
         for (int i=0; i<deploymentConfigs.length; i++) {
             Artifact artifact = geronimoToMavenArtifact(org.apache.geronimo.kernel.repository.Artifact.create(deploymentConfigs[i]));
             log.debug("Resolving deployer module: " + artifact);
-            resolveArtifact(artifact, true);
+            Artifact resolved = resolveArtifact(artifact, true);
+            additionalArtifacts.add(resolved);
         }
+        //Ensure that these dependencies are available to geronimo
+        if (project.getDependencyArtifacts() == null) {
+            Set oldArtifacts = project.createArtifacts(dependencyHelper.getArtifactFactory(),
null, null);
+            additionalArtifacts.addAll(oldArtifacts);
+        } else {
+            Set oldArtifacts = project.getDependencyArtifacts();
+            additionalArtifacts.addAll(oldArtifacts);
+        }
+        project.setDependencyArtifacts(additionalArtifacts);
+
 
         // If module is set, then resolve the artifact and set moduleFile
         if (module != null) {
@@ -260,14 +273,15 @@
             moduleFile = artifact.getFile();
             log.debug("Using module file: " + moduleFile);
         }
+        dependencies.setRootNode(dependencyHelper.getDependencies(project).getRootNode());
 
-        generateExplicitVersionProperties(explicitResolutionProperties);
+        generateExplicitVersionProperties(explicitResolutionProperties, dependencies);
 
         //
         // NOTE: Install a local lookup, so that the cached kernel can resolve based on the
current project
         //       and not the project where the kernel was first initialized.
         //
-        lookupHolder.set(new ArtifactLookupImpl());
+        lookupHolder.set(new ArtifactLookupImpl(new HashMap()));
 
         if (bootstrap) {
             executeBootShell();
@@ -404,6 +418,8 @@
 
     private boolean targetSet;
 
+    private static DependencyTree dependencies = new DependencyTree();
+
     public void buildPackage() throws Exception {
         log.info("Packaging module configuration: " + planFile);
 
@@ -442,6 +458,7 @@
 
         AbstractName deployer = locateDeployer(kernel);
         invokeDeployer(kernel, deployer, targetConfigStoreAName.toString());
+//        kernel.shutdown();
     }
 
     /**
@@ -513,6 +530,7 @@
             }
         };
         repoGBean.setAttribute("lookup", lookup);
+        repoGBean.setAttribute("dependencies", dependencies);
         repoNames.add(repoGBean.getAbstractName());
 
         // Target repo
@@ -628,81 +646,6 @@
     /**
      * Map of G artifact to M artifact which have already been resolved.
      */
-    private static Map presolvedArtifacts = new HashMap();
-
-    private class ArtifactLookupImpl
-        implements Maven2RepositoryAdapter.ArtifactLookup
-    {
-        public File getBasedir() {
-            String path = getArtifactRepository().getBasedir();
-            return new File(path);
-        }
-
-        private boolean isProjectArtifact(final org.apache.geronimo.kernel.repository.Artifact
artifact) {
-            MavenProject project = getProject();
-
-            return artifact.getGroupId().equals(project.getGroupId()) &&
-                   artifact.getArtifactId().equals(project.getArtifactId());
-        }
-
-        public File getLocation(final org.apache.geronimo.kernel.repository.Artifact artifact)
{
-            assert artifact != null;
-
-            boolean debug = log.isDebugEnabled();
-
-            Artifact mavenArtifact = (Artifact)presolvedArtifacts.get(artifact);
-
-            // If not cached, then make a new artifact
-            if (mavenArtifact == null) {
-                mavenArtifact = getArtifactFactory().createArtifact(
-                        artifact.getGroupId(),
-                        artifact.getArtifactId(),
-                        artifact.getVersion().toString(),
-                        null,
-                        artifact.getType()
-                );
-            }
+//    private static Map presolvedArtifacts = new HashMap();
 
-            // Do not attempt to resolve an artifact that is the same as the project
-            if (isProjectArtifact(artifact)) {
-                if (debug) {
-                    log.debug("Skipping resolution of project artifact: " + artifact);
-                }
-
-                //
-                // HACK: Still have to return something, otherwise some CAR packaging will
fail...
-                //       no idea what is using this file, or if the files does exist if that
will be
-                //       used instead of any details we are currently building
-                //
-                return new File(getBasedir(), getArtifactRepository().pathOf(mavenArtifact));
-            }
-
-            File file;
-            try {
-                if (!mavenArtifact.isResolved()) {
-                    if (debug) {
-                        log.debug("Resolving artifact: " + mavenArtifact);
-                    }
-                    mavenArtifact = resolveArtifact(mavenArtifact);
-
-                    // Cache the resolved artifact
-                    presolvedArtifacts.put(artifact, mavenArtifact);
-                }
-
-                //
-                // HACK: Construct the real local filename from the path and resolved artifact
file.
-                //       Probably a better way to do this with the Maven API directly, but
this is the
-                //       best I can do for now.
-                //
-                String path = getArtifactRepository().pathOf(mavenArtifact);
-                file = new File(getBasedir(), path);
-                file = new File(mavenArtifact.getFile().getParentFile(), file.getName());
-            }
-            catch (MojoExecutionException e) {
-                throw new RuntimeException("Failed to resolve: " + mavenArtifact, e);
-            }
-
-            return file;
-        }
-    }
 }

Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java?view=diff&rev=480326&r1=480325&r2=480326
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java
(original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java
Tue Nov 28 17:48:06 2006
@@ -273,13 +273,14 @@
             }
             return new org.apache.geronimo.kernel.repository.Dependency(artifact, ImportType.CLASSES);
         }
-        else if ("car".equalsIgnoreCase(type) && ("runtime").equalsIgnoreCase(scope))
{
-            return new org.apache.geronimo.kernel.repository.Dependency(artifact, ImportType.SERVICES);
-        }
-        else if ("car".equalsIgnoreCase(type) && ("compile".equalsIgnoreCase(scope)))
{
+        else if ("car".equalsIgnoreCase(type) && "runtime".equalsIgnoreCase(scope))
{
             return new org.apache.geronimo.kernel.repository.Dependency(artifact, ImportType.CLASSES);
         }
-        else if ("car".equalsIgnoreCase(type) && (scope == null)) { //parent
+        //doesn't work
+//        else if ("car".equalsIgnoreCase(type) && "provided".equalsIgnoreCase(scope))
{
+//            return new org.apache.geronimo.kernel.repository.Dependency(artifact, ImportType.CLASSES);
+//        }
+        else if ("car".equalsIgnoreCase(type) && (scope == null || "compile".equalsIgnoreCase(scope)))
{ //parent
             return new org.apache.geronimo.kernel.repository.Dependency(artifact, ImportType.ALL);
         }
         else {



Mime
View raw message