geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r617364 - in /geronimo/server/trunk: buildsupport/car-maven-plugin/src/it/j2ee-system-2/ buildsupport/car-maven-plugin/src/it/metadatageneration-2/ buildsupport/car-maven-plugin/src/it/metadatageneration-2/src/main/ buildsupport/car-maven-p...
Date Fri, 01 Feb 2008 07:44:44 GMT
Author: djencks
Date: Thu Jan 31 23:44:42 2008
New Revision: 617364

URL: http://svn.apache.org/viewvc?rev=617364&view=rev
Log:
GERONIMO-3791 Extract the dependencies from the deployed car file's environment to put in the geronimo-plugin.xml.  Use previous 'direct-from-maven' dependencies for boilerplate etc that do not have config.ser files

Added:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/src/main/
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/src/main/plan/
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/src/main/plan/plan.xml
      - copied unchanged from r617212, geronimo/server/trunk/framework/configs/jee-specs/src/main/plan/plan.xml
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
      - copied, changed from r617212, geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
Modified:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/goals.txt
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/pom.xml
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/goals.txt
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/pom.xml
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java
    geronimo/server/trunk/plugins/welcome/geronimo-welcome/src/main/java/org/apache/geronimo/welcome/AbsentSampleServlet.java

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/goals.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/goals.txt?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/goals.txt (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/goals.txt Thu Jan 31 23:44:42 2008
@@ -1 +1 @@
-org.apache.geronimo.buildsupport:car-maven-plugin:validate-configuration org.apache.geronimo.buildsupport:car-maven-plugin:prepare-plan org.apache.geronimo.buildsupport:car-maven-plugin:prepare-metadata 
+org.apache.geronimo.buildsupport:car-maven-plugin:validate-configuration org.apache.geronimo.buildsupport:car-maven-plugin:prepare-plan org.apache.geronimo.buildsupport:car-maven-plugin:package org.apache.geronimo.buildsupport:car-maven-plugin:prepare-metadata 

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/pom.xml?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/pom.xml (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/j2ee-system-2/pom.xml Thu Jan 31 23:44:42 2008
@@ -213,12 +213,11 @@
                     </classpath>
                     <classpathPrefix>../lib</classpathPrefix>
                     <category>Geronimo Core</category>
-                    <osiApproved>true</osiApproved>
-                    <geronimoVersion>2.1-SNAPSHOT</geronimoVersion>
                     <useMavenDependencies>
                         <value>true</value>
-                        <includeVersion>false</includeVersion>
+                        <includeVersion>true</includeVersion>
                     </useMavenDependencies>
+                    <config-xml-content load = "false"/>
                 </configuration>
             </plugin>
         </plugins>

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/goals.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/goals.txt?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/goals.txt (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/goals.txt Thu Jan 31 23:44:42 2008
@@ -1 +1 @@
-org.apache.geronimo.buildsupport:car-maven-plugin:prepare-metadata
+org.apache.geronimo.buildsupport:car-maven-plugin:prepare-plan org.apache.geronimo.buildsupport:car-maven-plugin:package org.apache.geronimo.buildsupport:car-maven-plugin:prepare-metadata

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/pom.xml?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/pom.xml (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/it/metadatageneration-2/pom.xml Thu Jan 31 23:44:42 2008
@@ -34,10 +34,18 @@
     <groupId>org.apache.geronimo.buildsupport.it</groupId>
     <artifactId>metadatatest-2</artifactId>
     <name>Metadata test 2</name>
-    <packaging>jar</packaging>
+    <packaging>car</packaging>
 
     <dependencies>
 
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-gbean-deployer</artifactId>
+            <version>${version}</version>
+            <type>car</type>
+            <scope>provided</scope>
+        </dependency>
+        
         <dependency>
             <groupId>velocity</groupId>
             <artifactId>velocity</artifactId>

Copied: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java (from r617212, geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java?p2=geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java&p1=geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java&r1=617212&r2=617364&rev=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java Thu Jan 31 23:44:42 2008
@@ -63,25 +63,18 @@
 import org.codehaus.plexus.util.FileUtils;
 
 /**
- * Build a Geronimo Configuration using the local Maven infrastructure.
+ * Jar up a packaged plugin
  *
- * @goal package
+ * @goal archive-car
  * @requiresDependencyResolution runtime
  *
  * @version $Rev$ $Date$
  */
-public class PackageMojo
+public class ArchiveCarMojo
     extends AbstractCarMojo
 {
 
     /**
-     * @component
-     * @required
-     * @readonly
-     */
-    private ArtifactFactory artifactFactory;
-
-    /**
      * The maven archive configuration to use.
      *
      * See <a href="http://maven.apache.org/ref/current/maven-archiver/apidocs/org/apache/maven/archiver/MavenArchiveConfiguration.html">the Javadocs for MavenArchiveConfiguration</a>.
@@ -89,16 +82,7 @@
      * @parameter
      */
     private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
-    
-    /**
-     * Require <tt>geronimoVersion</tt> property to be set.
-     *
-     * @parameter expression="${geronimoVersion}"
-     * @required
-     * @readonly
-     */
-    private String geronimoVersion = null;
-    
+
     /**
      * The Jar archiver.
      *
@@ -107,7 +91,7 @@
      * @readonly
      */
     private JarArchiver jarArchiver = null;
-    
+
     /**
      * The module base directory.
      *
@@ -116,7 +100,7 @@
      * @readonly
      */
     private File baseDirectory = null;
-    
+
     /**
      * Directory containing the generated archive.
      *
@@ -142,15 +126,6 @@
     private String finalName = null;
 
     /**
-     * The local Maven repository which will be used to pull artifacts into the Geronimo repository when packaging.
-     *
-     * @parameter expression="${settings.localRepository}"
-     * @required
-     * @readonly
-     */
-    private File repository = null;
-
-    /**
      * The Geronimo repository where modules will be packaged up from.
      *
      * @parameter expression="${project.build.directory}/repository"
@@ -159,52 +134,6 @@
     private File targetRepository = null;
 
     /**
-     * The default deployer module to be used when no other deployer modules are configured.
-     *
-     * @parameter expression="org.apache.geronimo.framework/geronimo-gbean-deployer/${geronimoVersion}/car"
-     * @required
-     * @readonly
-     */
-    private String defaultDeploymentConfig = null;
-
-    /**
-     * Ther deployer modules to be used when packaging.
-     *
-     * @parameter
-     */
-    private String[] deploymentConfigs;
-
-    /**
-     * The name of the deployer which will be used to deploy the CAR.
-     *
-     * @parameter expression="org.apache.geronimo.framework/geronimo-gbean-deployer/${geronimoVersion}/car?j2eeType=Deployer,name=Deployer"
-     * @required
-     */
-    private String deployerName = null;
-
-    /**
-     * The plan file for the CAR.
-     *
-     * @parameter expression="${project.build.directory}/resources/META-INF/plan.xml"
-     * @required
-     */
-    private File planFile = null;
-
-    /**
-     * The file to include as a module of the CAR.
-     *
-     * @parameter
-     */
-    private File moduleFile = null;
-
-    /**
-     * An {@link ArtifactItem} to include as a module of the CAR.
-     *
-     * @parameter
-     */
-    private ArtifactItem module = null;
-
-    /**
      * The location where the properties mapping will be generated.
      *
      * <p>
@@ -216,7 +145,7 @@
     private File explicitResolutionProperties = null;
 
     /**
-     * An array of {@link ClasspathElement} objects which will be used to construct the
+     * An array of {@link org.apache.geronimo.mavenplugins.car.ClasspathElement} objects which will be used to construct the
      * Class-Path entry of the manifest.
      *
      * This is needed to allow per-element prefixes to be added, which the standard Maven archiver
@@ -235,108 +164,17 @@
     private String classpathPrefix = null;
 
     /**
-     * True to enable the bootshell when packaging.
-     *
-     * @parameter
-     */
-    private boolean bootstrap = false;
-
-    /**
      * Location of resources directory for additional content to include in the car.
      *
      * @parameter expression="${project.build.directory}/resources"
      */
     private File resourcesDir;
 
-    /**
-     * Holds a local repo lookup instance so that we can use the current project to resolve.
-     * This is required since the Kernel used to deploy is cached.
-     */
-    private static ThreadLocal<Maven2RepositoryAdapter.ArtifactLookup> lookupHolder = new ThreadLocal<Maven2RepositoryAdapter.ArtifactLookup>();
-
     //
     // Mojo
     //
 
     protected void doExecute() throws Exception {
-        // We need to make sure to clean up any previous work first or this operation will fail
-        FileUtils.forceDelete(targetRepository);
-        FileUtils.forceMkdir(targetRepository);
-
-        // Use the default configs if none specified
-        if (deploymentConfigs == null) {
-            if (!bootstrap) {
-                deploymentConfigs = new String[] {defaultDeploymentConfig};
-            } else {
-                deploymentConfigs = new String[] {};
-            }
-        }
-        log.debug("Deployment configs: " + Arrays.asList(deploymentConfigs));
-
-        //
-        // NOTE: Resolve deployment modules, this is needed to ensure that the proper artifacts are in the
-        //       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);
-            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) {
-            Artifact artifact = getArtifact(module);
-            moduleFile = artifact.getFile();
-            log.debug("Using module file: " + moduleFile);
-        }
-
-        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);
-
-        //
-        // 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(new HashMap()));
-
-        if (bootstrap) {
-            executeBootShell();
-        }
-        else {
-            buildPackage();
-        }
 
         // Build the archive
         File archive = createArchive();
@@ -358,21 +196,6 @@
         return dir;
     }
 
-    public void executeBootShell() throws Exception {
-        log.debug("Starting bootstrap shell...");
-
-        PluginBootstrap2 boot = new PluginBootstrap2();
-
-        boot.setBuildDir(outputDirectory);
-        boot.setCarFile(getArtifactInRepositoryDir());
-        boot.setLocalRepo(repository);
-        boot.setPlan(planFile);
-
-        // Generate expanded so we can use Maven to generate the archive
-        boot.setExpanded(true);
-
-        boot.bootstrap();
-    }
 
     /**
      * Generates the configuration archive.
@@ -396,7 +219,7 @@
             if (resourcesDir.isDirectory()) {
                 archiver.getArchiver().addDirectory(resourcesDir);
             }
-            
+
             //
             // HACK: Include legal files here for sanity
             //
@@ -414,7 +237,7 @@
             };
 
             archiver.getArchiver().addDirectory(baseDirectory, "META-INF/", includes, new String[0]);
-            
+
             if (classpath != null) {
                 archive.addManifestEntry("Class-Path", getClassPath());
             }
@@ -469,263 +292,4 @@
         return buff.toString();
     }
 
-    //
-    // Deployment
-    //
-
-    private static final String KERNEL_NAME = "geronimo.maven";
-
-    /**
-     * Reference to the kernel that will last the lifetime of this classloader.
-     * The KernelRegistry keeps soft references that may be garbage collected.
-     */
-    private Kernel kernel;
-
-    private AbstractName targetConfigStoreAName;
-
-    private AbstractName targetRepositoryAName;
-
-    private boolean targetSet;
-
-    private DependencyTree dependencies = new DependencyTree();
-
-    public void buildPackage() throws Exception {
-        log.info("Packaging module configuration: " + planFile);
-
-        Kernel kernel = createKernel();
-        if (!targetSet) {
-            kernel.stopGBean(targetRepositoryAName);
-            kernel.setAttribute(targetRepositoryAName, "root", targetRepository.toURI());
-            kernel.startGBean(targetRepositoryAName);
-
-            if (kernel.getGBeanState(targetConfigStoreAName) != State.RUNNING_INDEX) {
-                throw new IllegalStateException("After restarted repository then config store is not running");
-            }
-
-            targetSet = true;
-        }
-
-        log.debug("Starting configuration...");
-
-        // start the Configuration we're going to use for this deployment
-        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
-        try {
-            for (int i=0; i<deploymentConfigs.length; i++) {
-                String artifactName = deploymentConfigs[i];
-                org.apache.geronimo.kernel.repository.Artifact configName =
-                        org.apache.geronimo.kernel.repository.Artifact.create(artifactName);
-                if (!configurationManager.isLoaded(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 {
-            ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
-        }
-
-        log.debug("Deploying...");
-
-        AbstractName deployer = locateDeployer(kernel);
-        invokeDeployer(kernel, deployer, targetConfigStoreAName.toString());
-        //use a fresh kernel for each module
-        kernel.shutdown();
-        kernel = null;
-    }
-
-    /**
-     * Create a Geronimo Kernel to contain the deployment configurations.
-     */
-    private synchronized Kernel createKernel() throws Exception {
-        // first return our cached version
-        if (kernel != null) {
-            return kernel;
-        }
-
-        log.debug("Creating kernel...");
-
-        // check the registry in case someone else created one
-        kernel = KernelRegistry.getKernel(KERNEL_NAME);
-        if (kernel != null) {
-            return kernel;
-        }
-
-        GeronimoLogging geronimoLogging = GeronimoLogging.getGeronimoLogging("WARN");
-        if (geronimoLogging == null) {
-            geronimoLogging = GeronimoLogging.DEBUG;
-        }
-        GeronimoLogging.initialize(geronimoLogging);
-
-        // boot one ourselves
-        kernel = KernelFactory.newInstance().createKernel(KERNEL_NAME);
-        kernel.boot();
-
-        bootDeployerSystem();
-
-        return kernel;
-    }
-
-    /**
-     * Boot the in-Maven deployment system.
-     *
-     * <p>
-     * This contains Repository and ConfigurationStore GBeans that map to
-     * the local maven installation.
-     * </p>
-     */
-    private void bootDeployerSystem() throws Exception {
-        log.debug("Booting deployer system...");
-
-        org.apache.geronimo.kernel.repository.Artifact baseId =
-                new org.apache.geronimo.kernel.repository.Artifact("geronimo", "packaging", "fixed", "car");
-        Naming naming = kernel.getNaming();
-        ConfigurationData bootstrap = new ConfigurationData(baseId, naming);
-        ClassLoader cl = getClass().getClassLoader();
-        Set repoNames = new HashSet();
-
-        //
-        // NOTE: Install an adapter for the source repository that will leverage the Maven2 repository subsystem
-        //       to allow for better handling of SNAPSHOT values.
-        //
-        GBeanData repoGBean = bootstrap.addGBean("SourceRepository", GBeanInfo.getGBeanInfo(Maven2RepositoryAdapter.class.getName(), cl));
-        Maven2RepositoryAdapter.ArtifactLookup lookup = new Maven2RepositoryAdapter.ArtifactLookup() {
-            private Maven2RepositoryAdapter.ArtifactLookup getDelegate() {
-                return (Maven2RepositoryAdapter.ArtifactLookup) lookupHolder.get();
-            }
-            
-            public File getBasedir() {
-                return getDelegate().getBasedir();
-            }
-
-            public File getLocation(final org.apache.geronimo.kernel.repository.Artifact artifact) {
-                return getDelegate().getLocation(artifact);
-            }
-        };
-        repoGBean.setAttribute("lookup", lookup);
-        repoGBean.setAttribute("dependencies", dependencies);
-        repoNames.add(repoGBean.getAbstractName());
-
-        // Target repo
-        GBeanData targetRepoGBean = bootstrap.addGBean("TargetRepository", GBeanInfo.getGBeanInfo(Maven2Repository.class.getName(), cl));
-        URI targetRepositoryURI = targetRepository.toURI();
-        targetRepoGBean.setAttribute("root", targetRepositoryURI);
-        repoNames.add(targetRepoGBean.getAbstractName());
-        targetRepositoryAName = targetRepoGBean.getAbstractName();
-
-        GBeanData artifactManagerGBean = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
-        GBeanData artifactResolverGBean = bootstrap.addGBean("ArtifactResolver", ExplicitDefaultArtifactResolver.GBEAN_INFO);
-        artifactResolverGBean.setAttribute("versionMapLocation", explicitResolutionProperties.getAbsolutePath());
-        ReferencePatterns repoPatterns = new ReferencePatterns(repoNames);
-        artifactResolverGBean.setReferencePatterns("Repositories", repoPatterns);
-        artifactResolverGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
-
-        Set storeNames = new HashSet();
-
-        // Source config store
-        GBeanInfo configStoreInfo = GBeanInfo.getGBeanInfo(MavenConfigStore.class.getName(), cl);
-        GBeanData storeGBean = bootstrap.addGBean("ConfigStore", configStoreInfo);
-        if (configStoreInfo.getReference("Repository") != null) {
-            storeGBean.setReferencePattern("Repository", repoGBean.getAbstractName());
-        }
-        storeNames.add(storeGBean.getAbstractName());
-
-        // Target config store
-        GBeanInfo targetConfigStoreInfo = GBeanInfo.getGBeanInfo(RepositoryConfigurationStore.class.getName(), cl);
-        GBeanData targetStoreGBean = bootstrap.addGBean("TargetConfigStore", targetConfigStoreInfo);
-        if (targetConfigStoreInfo.getReference("Repository") != null) {
-            targetStoreGBean.setReferencePattern("Repository", targetRepoGBean.getAbstractName());
-        }
-        storeNames.add(targetStoreGBean.getAbstractName());
-
-        targetConfigStoreAName = targetStoreGBean.getAbstractName();
-        targetSet = true;
-
-        GBeanData attrManagerGBean = bootstrap.addGBean("AttributeStore", MavenAttributeStore.GBEAN_INFO);
-        GBeanData configManagerGBean = bootstrap.addGBean("ConfigManager", KernelConfigurationManager.GBEAN_INFO);
-        configManagerGBean.setReferencePatterns("Stores", new ReferencePatterns(storeNames));
-        configManagerGBean.setReferencePattern("AttributeStore", attrManagerGBean.getAbstractName());
-        configManagerGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
-        configManagerGBean.setReferencePattern("ArtifactResolver", artifactResolverGBean.getAbstractName());
-        configManagerGBean.setReferencePatterns("Repositories", repoPatterns);
-
-        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, cl);
-    }
-
-    /**
-     * Locate a Deployer GBean matching the deployerName pattern.
-     *
-     * @param kernel the kernel to search.
-     * @return the ObjectName of the Deployer GBean
-     *
-     * @throws IllegalStateException if there is not exactly one GBean matching the deployerName pattern
-     */
-    private AbstractName locateDeployer(final Kernel kernel) {
-        AbstractName name = new AbstractName(URI.create(deployerName));
-
-        Iterator i = kernel.listGBeans(new AbstractNameQuery(name)).iterator();
-        if (!i.hasNext()) {
-            throw new IllegalStateException("No deployer found matching deployerName: " + name);
-        }
-
-        AbstractName deployer = (AbstractName)i.next();
-        if (i.hasNext()) {
-            throw new IllegalStateException("Multiple deployers found matching deployerName: " + name);
-        }
-
-        return deployer;
-    }
-
-    private static final String[] DEPLOY_SIGNATURE = {
-        boolean.class.getName(),
-        File.class.getName(),
-        File.class.getName(),
-        File.class.getName(),
-        Boolean.TYPE.getName(),
-        String.class.getName(),
-        String.class.getName(),
-        String.class.getName(),
-        String.class.getName(),
-        String.class.getName(),
-        String.class.getName(),
-        String.class.getName(),
-        String.class.getName(),
-    };
-
-    private List invokeDeployer(final Kernel kernel, final AbstractName deployer, final String targetConfigStore) throws Exception {
-        Object[] args = {
-            Boolean.FALSE, // Not in-place
-            moduleFile,
-            planFile,
-            null, // Target file
-            Boolean.TRUE, // Install
-            null, // main-class
-            null, // main-gbean
-            null, // main-method
-            null, // Manifest configurations
-            null, // class-path
-            null, // endorsed-dirs
-            null, // extension-dirs
-            targetConfigStore
-        };
-
-        return (List) kernel.invoke(deployer, "deploy", args, DEPLOY_SIGNATURE);
-    }
-
-    //
-    // ArtifactLookupImpl
-    //
-
-    /**
-     * Map of G artifact to M artifact which have already been resolved.
-     */
-    // private static Map presolvedArtifacts = new HashMap();
-}
+}
\ No newline at end of file

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PackageMojo.java Thu Jan 31 23:44:42 2008
@@ -52,10 +52,8 @@
 import org.apache.geronimo.system.repository.Maven2Repository;
 import org.apache.geronimo.system.resolver.ExplicitDefaultArtifactResolver;
 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;
@@ -81,42 +79,7 @@
      */
     private ArtifactFactory artifactFactory;
 
-    /**
-     * The maven archive configuration to use.
-     *
-     * See <a href="http://maven.apache.org/ref/current/maven-archiver/apidocs/org/apache/maven/archiver/MavenArchiveConfiguration.html">the Javadocs for MavenArchiveConfiguration</a>.
-     *
-     * @parameter
-     */
-    private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
-    
-    /**
-     * Require <tt>geronimoVersion</tt> property to be set.
-     *
-     * @parameter expression="${geronimoVersion}"
-     * @required
-     * @readonly
-     */
-    private String geronimoVersion = null;
-    
-    /**
-     * The Jar archiver.
-     *
-     * @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
-     * @required
-     * @readonly
-     */
-    private JarArchiver jarArchiver = null;
-    
-    /**
-     * The module base directory.
-     *
-     * @parameter expression="${project.basedir}"
-     * @required
-     * @readonly
-     */
-    private File baseDirectory = null;
-    
+
     /**
      * Directory containing the generated archive.
      *
@@ -126,22 +89,6 @@
     private File outputDirectory = null;
 
     /**
-     * Directory containing the classes/resources.
-     *
-     * @parameter expression="${project.build.outputDirectory}"
-     * @required
-     */
-    private File classesDirectory = null;
-
-    /**
-     * Name of the generated archive.
-     *
-     * @parameter expression="${project.build.finalName}"
-     * @required
-     */
-    private String finalName = null;
-
-    /**
      * The local Maven repository which will be used to pull artifacts into the Geronimo repository when packaging.
      *
      * @parameter expression="${settings.localRepository}"
@@ -216,25 +163,6 @@
     private File explicitResolutionProperties = null;
 
     /**
-     * An array of {@link ClasspathElement} objects which will be used to construct the
-     * Class-Path entry of the manifest.
-     *
-     * This is needed to allow per-element prefixes to be added, which the standard Maven archiver
-     * does not provide.
-     *
-     * @parameter
-     */
-    private ClasspathElement[] classpath = null;
-
-    /**
-     * The default prefix to be applied to all elements of the <tt>classpath</tt> which
-     * do not provide a prefix.
-     *
-     * @parameter
-     */
-    private String classpathPrefix = null;
-
-    /**
      * True to enable the bootshell when packaging.
      *
      * @parameter
@@ -242,13 +170,6 @@
     private boolean bootstrap = false;
 
     /**
-     * Location of resources directory for additional content to include in the car.
-     *
-     * @parameter expression="${project.build.directory}/resources"
-     */
-    private File resourcesDir;
-
-    /**
      * Holds a local repo lookup instance so that we can use the current project to resolve.
      * This is required since the Kernel used to deploy is cached.
      */
@@ -278,19 +199,19 @@
         //       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]));
+        Set<Artifact> additionalArtifacts = new HashSet<Artifact>();
+        for (String deploymentConfig : deploymentConfigs) {
+            Artifact artifact = geronimoToMavenArtifact(org.apache.geronimo.kernel.repository.Artifact.create(deploymentConfig));
             log.debug("Resolving deployer module: " + artifact);
             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);
+            Set<Artifact> oldArtifacts = project.createArtifacts(dependencyHelper.getArtifactFactory(), null, null);
             additionalArtifacts.addAll(oldArtifacts);
         } else {
-            Set oldArtifacts = project.getDependencyArtifacts();
+            Set<Artifact> oldArtifacts = project.getDependencyArtifacts();
             additionalArtifacts.addAll(oldArtifacts);
         }
         project.setDependencyArtifacts(additionalArtifacts);
@@ -337,12 +258,6 @@
         else {
             buildPackage();
         }
-
-        // Build the archive
-        File archive = createArchive();
-
-        // Attach the generated archive for install/deploy
-        project.getArtifact().setFile(archive);
     }
 
     private File getArtifactInRepositoryDir() {
@@ -374,100 +289,6 @@
         boot.bootstrap();
     }
 
-    /**
-     * Generates the configuration archive.
-     */
-    private File createArchive() throws MojoExecutionException {
-        File archiveFile = getArchiveFile(outputDirectory, finalName, null);
-
-        MavenArchiver archiver = new MavenArchiver();
-        archiver.setArchiver(jarArchiver);
-        archiver.setOutputFile(archiveFile);
-
-        try {
-            // Incldue the generated artifact contents
-            archiver.getArchiver().addDirectory(getArtifactInRepositoryDir());
-
-            // Include the optional classes.resources
-            if (classesDirectory.isDirectory()) {
-                archiver.getArchiver().addDirectory(classesDirectory);
-            }
-
-            if (resourcesDir.isDirectory()) {
-                archiver.getArchiver().addDirectory(resourcesDir);
-            }
-            
-            //
-            // HACK: Include legal files here for sanity
-            //
-
-            //
-            // NOTE: Would be nice to share this with the copy-legal-files mojo
-            //
-            String[] includes = {
-                "LICENSE.txt",
-                "LICENSE",
-                "NOTICE.txt",
-                "NOTICE",
-                "DISCLAIMER.txt",
-                "DISCLAIMER"
-            };
-
-            archiver.getArchiver().addDirectory(baseDirectory, "META-INF/", includes, new String[0]);
-            
-            if (classpath != null) {
-                archive.addManifestEntry("Class-Path", getClassPath());
-            }
-
-            archiver.createArchive(project, archive);
-
-            return archiveFile;
-        }
-        catch (Exception e) {
-            throw new MojoExecutionException("Failed to create archive", e);
-        }
-    }
-
-    private String getClassPath() throws MojoExecutionException {
-        StringBuffer buff = new StringBuffer();
-
-        for (int i=0; i < classpath.length; i++) {
-            String entry = classpath[i].getEntry();
-            if (entry != null) {
-                buff.append(entry);
-            } else {
-                Artifact artifact = getArtifact(classpath[i]);
-
-                //
-                // TODO: Need to optionally get all transitive dependencies... but dunno how to get that intel from m2
-                //
-
-                String prefix = classpath[i].getClasspathPrefix();
-                if (prefix == null) {
-                    prefix = classpathPrefix;
-                }
-
-                if (prefix != null) {
-                    buff.append(prefix);
-
-                    if (!prefix.endsWith("/")) {
-                        buff.append("/");
-                    }
-                }
-
-                File file = artifact.getFile();
-                buff.append(file.getName());
-            }
-
-            if (i + 1< classpath.length) {
-                buff.append(" ");
-            }
-        }
-
-        log.debug("Using classpath: " + buff);
-
-        return buff.toString();
-    }
 
     //
     // Deployment
@@ -505,15 +326,13 @@
             targetSet = true;
         }
 
-        log.debug("Starting configuration...");
+        log.debug("Starting configurations..." + Arrays.asList(deploymentConfigs));
 
         // start the Configuration we're going to use for this deployment
         ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
         try {
-            for (int i=0; i<deploymentConfigs.length; i++) {
-                String artifactName = deploymentConfigs[i];
-                org.apache.geronimo.kernel.repository.Artifact configName =
-                        org.apache.geronimo.kernel.repository.Artifact.create(artifactName);
+            for (String artifactName : deploymentConfigs) {
+                org.apache.geronimo.kernel.repository.Artifact configName = org.apache.geronimo.kernel.repository.Artifact.create(artifactName);
                 if (!configurationManager.isLoaded(configName)) {
                     RecordingLifecycleMonitor monitor = new RecordingLifecycleMonitor();
                     try {
@@ -524,6 +343,7 @@
                     monitor = new RecordingLifecycleMonitor();
                     try {
                         configurationManager.startConfiguration(configName, monitor);
+                        log.info("Started deployer: " + configName);
                     } catch (LifecycleException e) {
                         log.error("Could not start deployer configuration: " + configName + "\n" + monitor.toString(), e);
                     }
@@ -590,7 +410,7 @@
         Naming naming = kernel.getNaming();
         ConfigurationData bootstrap = new ConfigurationData(baseId, naming);
         ClassLoader cl = getClass().getClassLoader();
-        Set repoNames = new HashSet();
+        Set<AbstractName> repoNames = new HashSet<AbstractName>();
 
         //
         // NOTE: Install an adapter for the source repository that will leverage the Maven2 repository subsystem
@@ -599,7 +419,7 @@
         GBeanData repoGBean = bootstrap.addGBean("SourceRepository", GBeanInfo.getGBeanInfo(Maven2RepositoryAdapter.class.getName(), cl));
         Maven2RepositoryAdapter.ArtifactLookup lookup = new Maven2RepositoryAdapter.ArtifactLookup() {
             private Maven2RepositoryAdapter.ArtifactLookup getDelegate() {
-                return (Maven2RepositoryAdapter.ArtifactLookup) lookupHolder.get();
+                return lookupHolder.get();
             }
             
             public File getBasedir() {
@@ -720,12 +540,4 @@
         return (List) kernel.invoke(deployer, "deploy", args, DEPLOY_SIGNATURE);
     }
 
-    //
-    // ArtifactLookupImpl
-    //
-
-    /**
-     * Map of G artifact to M artifact which have already been resolved.
-     */
-    // private static Map presolvedArtifacts = new HashMap();
 }

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginMetadataGeneratorMojo.java Thu Jan 31 23:44:42 2008
@@ -22,16 +22,25 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.StringReader;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
+import org.apache.geronimo.system.plugin.PluginInstallerGBean;
 import org.apache.geronimo.system.plugin.PluginXmlUtil;
 import org.apache.geronimo.system.plugin.model.ArtifactType;
 import org.apache.geronimo.system.plugin.model.DependencyType;
 import org.apache.geronimo.system.plugin.model.LicenseType;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
 import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.repository.Maven2Repository;
 import org.apache.maven.model.License;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
@@ -50,6 +59,14 @@
 
 
     /**
+     * The Geronimo repository where modules will be packaged up from.
+     *
+     * @parameter expression="${project.build.directory}/repository"
+     * @required
+     */
+    private File targetRepository = null;
+
+    /**
      * Directory for generated plugin metadata file.
      *
      * @parameter expression="${project.build.directory}/resources/"
@@ -114,10 +131,8 @@
     /**
      * Configuration for this instance itself.  This is a plugin-artifactType element without moduleId or dependencies. Do not include more than one of these in the parent poms
      * since maven will not merge them correctly.  Actually we have to fish this out of the model since maven mangles the xml for us.
-     *
      */
 //    private PlexusConfiguration instance;
-
     protected void doExecute() throws Exception {
 
         PluginType metadata = new PluginType();
@@ -140,7 +155,7 @@
         if (plugin == null) {
             throw new Error("Unable to resolve car plugin");
         }
-        
+
         Xpp3Dom dom;
         if (plugin.getExecutions().isEmpty()) {
             dom = (Xpp3Dom) plugin.getConfiguration();
@@ -148,7 +163,7 @@
             if (plugin.getExecutions().size() > 1) {
                 throw new IllegalStateException("Cannot determine correct configuration for PluginMetadataGeneratorMojo: " + plugin.getExecutionsAsMap().keySet());
             }
-            dom = (Xpp3Dom) ((PluginExecution)plugin.getExecutions().get(0)).getConfiguration();
+            dom = (Xpp3Dom) ((PluginExecution) plugin.getExecutions().get(0)).getConfiguration();
         }
         Xpp3Dom instanceDom = dom.getChild("instance");
 
@@ -224,19 +239,27 @@
         getProject().getResources().add(resource);
     }
 
-    private void addDependencies(PluginArtifactType instance) {
+    private void addDependencies(PluginArtifactType instance) throws InvalidConfigException, IOException, NoSuchConfigException {
         if (useMavenDependencies == null || !useMavenDependencies.isValue()) {
             for (Dependency dependency : dependencies) {
                 instance.getDependency().add(dependency.toDependencyType());
             }
         } else {
-            List<org.apache.maven.model.Dependency> includedDependencies = project.getOriginalModel().getDependencies();
-            List<org.apache.maven.model.Dependency> artifacts = project.getDependencies();
-            for (org.apache.maven.model.Dependency dependency : includedDependencies) {
-                dependency = resolveDependency(dependency, artifacts);
-                if (includeDependency(dependency)) {
-                    DependencyType gdep = toGeronimoDependency(dependency, useMavenDependencies.isIncludeVersion());
-                    instance.getDependency().add(gdep);
+            if (targetRepository.exists() && targetRepository.isDirectory()) {
+                Maven2Repository targetRepo = new Maven2Repository(targetRepository);
+                ConfigurationStore configStore = new RepositoryConfigurationStore(targetRepo);
+                Artifact pluginArtifact = PluginInstallerGBean.toArtifact(instance.getModuleId());
+                ConfigurationData data = configStore.loadConfiguration(pluginArtifact);
+                PluginInstallerGBean.addGeronimoDependencies(data, instance.getDependency(), useMavenDependencies.isIncludeVersion());
+            } else {
+                List<org.apache.maven.model.Dependency> includedDependencies = project.getOriginalModel().getDependencies();
+                List<org.apache.maven.model.Dependency> artifacts = project.getDependencies();
+                for (org.apache.maven.model.Dependency dependency : includedDependencies) {
+                    dependency = resolveDependency(dependency, artifacts);
+                    if (includeDependency(dependency)) {
+                        DependencyType gdep = toGeronimoDependency(dependency, useMavenDependencies.isIncludeVersion());
+                        instance.getDependency().add(gdep);
+                    }
                 }
             }
 

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml Thu Jan 31 23:44:42 2008
@@ -40,11 +40,12 @@
                             </process-resources>
                             <compile>
                                 org.apache.geronimo.buildsupport:car-maven-plugin:validate-configuration,
-                                org.apache.geronimo.buildsupport:car-maven-plugin:prepare-plan,
-                                org.apache.geronimo.buildsupport:car-maven-plugin:prepare-metadata
+                                org.apache.geronimo.buildsupport:car-maven-plugin:prepare-plan
                             </compile>
                             <package>
-                                org.apache.geronimo.buildsupport:car-maven-plugin:package
+                                org.apache.geronimo.buildsupport:car-maven-plugin:package,
+                                org.apache.geronimo.buildsupport:car-maven-plugin:prepare-metadata,
+                                org.apache.geronimo.buildsupport:car-maven-plugin:archive-car
                             </package>
                             <install>
                                 org.apache.maven.plugins:maven-install-plugin:install,

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Thu Jan 31 23:44:42 2008
@@ -1359,16 +1359,7 @@
                 (Version) null,
                 moduleId.getType())));
         List<DependencyType> deps = instance.getDependency();
-        PrerequisiteType prereq = null;
-        prereq = processDependencyList(data.getEnvironment().getDependencies(), prereq, deps);
-        Map children = data.getChildConfigurations();
-        for (Object o : children.values()) {
-            ConfigurationData child = (ConfigurationData) o;
-            prereq = processDependencyList(child.getEnvironment().getDependencies(), prereq, deps);
-        }
-        if (prereq != null) {
-            instance.getPrerequisite().add(prereq);
-        }
+        addGeronimoDependencies(data, deps, true);
         return meta;
     }
 
@@ -1441,31 +1432,39 @@
         }
     }
 
+    public static void addGeronimoDependencies(ConfigurationData data, List<DependencyType> deps, boolean includeVersion) {
+        processDependencyList(data.getEnvironment().getDependencies(), deps, includeVersion);
+        Map<String, ConfigurationData> children = data.getChildConfigurations();
+        for (ConfigurationData child : children.values()) {
+            processDependencyList(child.getEnvironment().getDependencies(), deps, includeVersion);
+        }
+    }
+
     /**
      * Generates dependencies and an optional prerequisite based on a list of
      * dependencies for a Gernonimo module.
      *
      * @param real   A list with elements of type Dependency
-     * @param prereq The incoming prerequisite (if any), which may be replaced
      * @param deps   A list with elements of type String (holding a module ID / Artifact name)
-     * @return The resulting prerequisite, if any.
+     * @param includeVersion whether to include a version in the plugin xml dependency
      */
-    private PrerequisiteType processDependencyList(List<Dependency> real, PrerequisiteType prereq, List<DependencyType> deps) {
+    private static void processDependencyList(List<Dependency> real, List<DependencyType> deps, boolean includeVersion) {
         for (Dependency dep : real) {
-            DependencyType dependency = toDependencyType(dep);
+            DependencyType dependency = toDependencyType(dep, includeVersion);
             if (!deps.contains(dependency)) {
                 deps.add(dependency);
             }
         }
-        return prereq;
     }
 
-    public static DependencyType toDependencyType(Dependency dep) {
+    public static DependencyType toDependencyType(Dependency dep, boolean includeVersion) {
         Artifact id = dep.getArtifact();
         DependencyType dependency = new DependencyType();
         dependency.setGroupId(id.getGroupId());
         dependency.setArtifactId(id.getArtifactId());
-        dependency.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
+        if (includeVersion) {
+            dependency.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
+        }
         dependency.setType(id.getType());
         return dependency;
     }

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java (original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java Thu Jan 31 23:44:42 2008
@@ -239,7 +239,7 @@
         result.clear();
         for (String artifact : artifacts) {
             //TODO this is wrong.... need to encode import type as well
-            result.add(PluginInstallerGBean.toDependencyType(new Dependency(Artifact.create(artifact), ImportType.ALL)));
+            result.add(PluginInstallerGBean.toDependencyType(new Dependency(Artifact.create(artifact), ImportType.ALL), true));
         }
     }
 

Modified: geronimo/server/trunk/plugins/welcome/geronimo-welcome/src/main/java/org/apache/geronimo/welcome/AbsentSampleServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/welcome/geronimo-welcome/src/main/java/org/apache/geronimo/welcome/AbsentSampleServlet.java?rev=617364&r1=617363&r2=617364&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/welcome/geronimo-welcome/src/main/java/org/apache/geronimo/welcome/AbsentSampleServlet.java (original)
+++ geronimo/server/trunk/plugins/welcome/geronimo-welcome/src/main/java/org/apache/geronimo/welcome/AbsentSampleServlet.java Thu Jan 31 23:44:42 2008
@@ -79,7 +79,7 @@
         target.setDescription("A sample application");
         PluginArtifactType instance = new PluginArtifactType();
         target.getPluginArtifact().add(instance);
-        instance.getDependency().add(PluginInstallerGBean.toDependencyType(new Dependency(Artifact.create(moduleIdName), ImportType.ALL)));
+        instance.getDependency().add(PluginInstallerGBean.toDependencyType(new Dependency(Artifact.create(moduleIdName), ImportType.ALL), true));
         PluginListType list = new PluginListType();
         list.getPlugin().add(target);
 //        list.getDefaultRepository().add(repo.toString());



Mime
View raw message