You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/04/23 03:19:21 UTC

svn commit: r396191 [2/2] - in /geronimo/branches/1.1: applications/console-standard/src/java/org/apache/geronimo/console/car/ configs/client-deployer/src/plan/ configs/console-jetty/ configs/console-jetty/src/conf/ configs/console-tomcat/ configs/cons...

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/DownloadResults.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/DownloadResults.java?rev=396191&r1=396190&r2=396191&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/DownloadResults.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/DownloadResults.java Sat Apr 22 18:19:16 2006
@@ -40,48 +40,64 @@
     private boolean finished;
     private long totalDownloadBytes = 0;
 
-    public void addInstalledConfigID(Artifact dep) {
+    public synchronized DownloadResults duplicate() {
+        DownloadResults other = new DownloadResults();
+        other.removedConfigIDs.addAll(removedConfigIDs);
+        other.restartedConfigIDs.addAll(restartedConfigIDs);
+        other.installedConfigIDs.addAll(installedConfigIDs);
+        other.dependenciesPresent.addAll(dependenciesPresent);
+        other.dependenciesInstalled.addAll(dependenciesInstalled);
+        other.currentFile = currentFile;
+        other.currentMessage = currentMessage;
+        other.currentFileProgress = currentFileProgress;
+        other.failure = failure;
+        other.finished = finished;
+        other.totalDownloadBytes = totalDownloadBytes;
+        return other;
+    }
+
+    public synchronized void addInstalledConfigID(Artifact dep) {
         installedConfigIDs.add(dep);
     }
 
-    public void addRemovedConfigID(Artifact obsolete) {
+    public synchronized void addRemovedConfigID(Artifact obsolete) {
         removedConfigIDs.add(obsolete);
     }
 
-    public void addRestartedConfigID(Artifact target) {
+    public synchronized void addRestartedConfigID(Artifact target) {
         restartedConfigIDs.add(target);
     }
 
-    public void addDependencyPresent(Artifact dep) {
+    public synchronized void addDependencyPresent(Artifact dep) {
         dependenciesPresent.add(dep);
     }
 
-    public void addDependencyInstalled(Artifact dep) {
+    public synchronized void addDependencyInstalled(Artifact dep) {
         dependenciesInstalled.add(dep);
     }
 
-    public void setCurrentFile(String currentFile) {
+    public synchronized void setCurrentFile(String currentFile) {
         this.currentFile = currentFile;
     }
 
-    public void setCurrentMessage(String currentMessage) {
+    public synchronized void setCurrentMessage(String currentMessage) {
         this.currentMessage = currentMessage;
     }
 
-    public void setCurrentFilePercent(int currentFileProgress) {
+    public synchronized void setCurrentFilePercent(int currentFileProgress) {
         this.currentFileProgress = currentFileProgress;
     }
 
-    public void setFailure(Exception failure) {
+    public synchronized void setFailure(Exception failure) {
 failure.printStackTrace();
         this.failure = failure;
     }
 
-    public void setFinished() {
+    public synchronized void setFinished() {
         finished = true;
     }
 
-    public void addDownloadBytes(long bytes) {
+    public synchronized void addDownloadBytes(long bytes) {
         totalDownloadBytes += bytes;
     }
 

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java?rev=396191&r1=396190&r2=396191&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java Sat Apr 22 18:19:16 2006
@@ -166,6 +166,10 @@
         return value.trim();
     }
 
+    public void setTypeHandler(String type, ArtifactTypeHandler handler) {
+        typeHandlers.put(type, handler);
+    }
+
     public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException {
         if(!destination.isResolved()) {
             throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved");

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java?rev=396191&r1=396190&r2=396191&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java Sat Apr 22 18:19:16 2006
@@ -49,7 +49,11 @@
     public File getLocation(Artifact artifact) {
         File path = new File(rootFile, artifact.getGroupId());
         path = new File(path, artifact.getType() + "s");
-        path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType());
+        String ext = artifact.getType();
+        if(ext.equals("ejb")) {
+            ext = "jar";
+        }
+        path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + ext);
 
         return path;
     }
@@ -114,7 +118,7 @@
                 String groupId = matcher.group(1);
                 String artifactId = matcher.group(3);
                 String version = matcher.group(4);
-                String type = matcher.group(5);
+                String type = matcher.group(2);
                 artifacts.add(new Artifact(groupId, artifactId, version, type));
             } else {
             	log.warn("could not resolve URI for malformed repository entry: " + names[i] +

Added: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java?rev=396191&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java (added)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/util/PluginRepositoryExporter.java Sat Apr 22 18:19:16 2006
@@ -0,0 +1,314 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.system.util;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedSet;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.system.configuration.ConfigInstallerGBean;
+import org.apache.geronimo.system.configuration.ConfigurationArchiveData;
+import org.apache.geronimo.system.configuration.ConfigurationInstaller;
+import org.apache.geronimo.system.configuration.ConfigurationMetadata;
+import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
+import org.apache.geronimo.system.repository.Maven1Repository;
+import org.apache.geronimo.system.repository.Maven2Repository;
+import org.apache.geronimo.system.repository.CopyArtifactTypeHandler;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.SAXException;
+
+/**
+ * A utility that exports a repository of plugins.
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 21:48:27 -0500 (Sat, 10 Dec 2005) $
+ */
+public class PluginRepositoryExporter {
+    private Maven1Repository sourceRepo;
+    private Maven2Repository destRepo;
+    private Version targetVersion;
+    private ConfigInstallerGBean installer;
+    private File pluginList;
+
+    public PluginRepositoryExporter(String inPath, String outPath, String version) throws IOException {
+        File inFile = new File(inPath);
+        if(!inFile.isDirectory() || !inFile.canRead()) {
+            throw new IllegalArgumentException("Bad source repo directory "+inFile.getAbsolutePath());
+        }
+        File outFile = new File(outPath);
+        if(outFile.exists()) {
+            if(!outFile.isDirectory() || !outFile.canRead()) {
+                throw new IllegalArgumentException("Bad target repo directory "+outFile.getAbsolutePath());
+            }
+        } else {
+            if(!outFile.mkdirs()) {
+                throw new IllegalArgumentException("Can't create target repo directory "+outFile.getAbsolutePath());
+            }
+        }
+        pluginList = new File(outFile, "geronimo-plugins.xml");
+        if(!pluginList.exists()) {
+            if(!pluginList.createNewFile()) {
+                throw new IllegalArgumentException("Can't create target plugin list file "+pluginList.getAbsolutePath());
+            }
+        }
+        sourceRepo = new Maven1Repository(inFile);
+        destRepo = new Maven2Repository(outFile);
+        destRepo.setTypeHandler("car", new CopyArtifactTypeHandler());
+        targetVersion = new Version(version);
+        RepositoryConfigurationStore store = new RepositoryConfigurationStore(destRepo);
+        ServerInfo info = new ServerInfo() {
+            public String getBaseDirectory() {
+                return null;
+            }
+
+            public String getBuildDate() {
+                return null;
+            }
+
+            public String getBuildTime() {
+                return null;
+            }
+
+            public String getCopyright() {
+                return null;
+            }
+
+            public String getCurrentBaseDirectory() {
+                return null;
+            }
+
+            public String getVersion() {
+                return targetVersion.toString();
+            }
+
+            public File resolve(final String filename) {
+                return null;
+            }
+
+            public URI resolve(final URI uri) {
+                return null;
+            }
+
+            public String resolvePath(final String filename) {
+                return null;
+            }
+        };
+        installer = new ConfigInstallerGBean(null, destRepo, store, info, null);
+    }
+
+    public void execute() throws IOException {
+        SortedSet list = sourceRepo.list();
+        try {
+            for (Iterator it = list.iterator(); it.hasNext();) {
+                Artifact artifact = (Artifact) it.next();
+                if(((artifact.getGroupId().equals("geronimo") && artifact.getVersion().equals(targetVersion)) ||
+                        artifact.getGroupId().equals("activemq") ||
+                        artifact.getGroupId().equals("openejb")
+                        )
+                        && !artifact.getType().equals("pom") && !artifact.getType().equals("distribution") && !artifact.getType().equals("plugin")) {
+                    System.out.println("Copying "+artifact);
+                    if(destRepo.contains(artifact)) {
+                        File location = destRepo.getLocation(artifact);
+                        IOUtil.recursiveDelete(location);
+                    }
+                    destRepo.copyToRepository(sourceRepo.getLocation(artifact), artifact, null);
+                    File dest = destRepo.getLocation(artifact);
+                    File versionDir = dest.getParentFile();
+                    File artifactDir = versionDir.getParentFile();
+                    if(!artifactDir.isDirectory() || !artifactDir.canRead()) {
+                        throw new IllegalStateException("Failed to located group/artifact dir for "+artifact+" (got "+artifactDir.getAbsolutePath()+")");
+                    }
+                    updateMavenMetadata(artifactDir, artifact);
+                }
+            }
+            Map plugins = installer.getInstalledPlugins();
+            Document doc = generateConfigFile(installer, plugins.values());
+            TransformerFactory xfactory = TransformerFactory.newInstance();
+            Transformer xform = xfactory.newTransformer();
+            xform.setOutputProperty(OutputKeys.INDENT, "yes");
+            System.out.println("Writing geronimo-plugins.xml file...");
+            FileWriter out = new FileWriter(pluginList);
+            xform.transform(new DOMSource(doc), new StreamResult(out));
+            out.flush();
+            out.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new IOException("Unable to format XML output: "+e.getMessage());
+        }
+
+    }
+
+    private void updateMavenMetadata(File dir, Artifact artifact) throws TransformerException, IOException, SAXException, ParserConfigurationException {
+        File mavenFile = new File(dir, "maven-metadata.xml");
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder builder = factory.newDocumentBuilder();
+        Document doc;
+        if(mavenFile.exists()) {
+            doc = builder.parse(mavenFile);
+        } else {
+            doc = builder.newDocument();
+            createMavenMetadata(doc, artifact);
+        }
+        NodeList versions = doc.getElementsByTagName("versions");
+        Element versionsElement = (Element) versions.item(0);
+        versions = versionsElement.getElementsByTagName("version");
+        boolean found = false;
+        for(int i=0; i<versions.getLength(); i++) {
+            String version = getText(versions.item(i)).trim();
+            if(version.equals(artifact.getVersion().toString())) {
+                found = true;
+                break;
+            }
+            Version test = new Version(version);
+            if(test.compareTo(artifact.getVersion()) > 0) {
+                Element newVersion = doc.createElement("version");
+                newVersion.appendChild(doc.createTextNode(artifact.getVersion().toString()));
+                versionsElement.insertBefore(newVersion, versions.item(i));
+                found = true;
+            }
+        }
+        if(!found) {
+            Element newVersion = doc.createElement("version");
+            newVersion.appendChild(doc.createTextNode(artifact.getVersion().toString()));
+            versionsElement.appendChild(newVersion);
+        }
+        TransformerFactory xfactory = TransformerFactory.newInstance();
+        Transformer xform = xfactory.newTransformer();
+        xform.setOutputProperty(OutputKeys.INDENT, "yes");
+        xform.transform(new DOMSource(doc), new StreamResult(mavenFile));
+    }
+
+    private void createMavenMetadata(Document doc, Artifact artifact) {
+        Element root = doc.createElement("metadata");
+        doc.appendChild(root);
+        createText(doc, root, "groupId", artifact.getGroupId());
+        createText(doc, root, "artifactId", artifact.getArtifactId());
+        createText(doc, root, "version", artifact.getVersion().toString());
+        Element versioning = doc.createElement("versioning");
+        root.appendChild(versioning);
+        Element versions = doc.createElement("versions");
+        versioning.appendChild(versions);
+        createText(doc, versions, "version", artifact.getVersion().toString());
+    }
+
+
+    private Document generateConfigFile(ConfigurationInstaller installer, Collection plugins) throws ParserConfigurationException {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder builder = factory.newDocumentBuilder();
+        Document doc = builder.newDocument();
+        Element root = doc.createElement("geronimo-plugin-list");
+        doc.appendChild(root);
+        for (Iterator it = plugins.iterator(); it.hasNext();) {
+            Artifact plugin = (Artifact) it.next();
+            System.out.println("Including plugin data for "+plugin);
+            ConfigurationArchiveData pluginData = installer.getPluginMetadata(plugin);
+            ConfigurationMetadata data = pluginData.getConfiguration();
+            Element config = doc.createElement("configuration");
+            root.appendChild(config);
+            createText(doc, config, "name", data.getName());
+            createText(doc, config, "config-id", data.getConfigId().toString());
+            createText(doc, config, "category", data.getCategory());
+            createText(doc, config, "description", data.getDescription());
+            for (int i = 0; i < data.getLicenses().length; i++) {
+                ConfigurationMetadata.License license = data.getLicenses()[i];
+                Element lic = doc.createElement("license");
+                lic.appendChild(doc.createTextNode(license.getName()));
+                lic.setAttribute("osi-approved", license.isOsiApproved() ? "true" : "false");
+                config.appendChild(lic);
+            }
+            for (int i = 0; i < data.getGeronimoVersions().length; i++) {
+                String version = data.getGeronimoVersions()[i];
+                createText(doc, config, "geronimo-version", version);
+            }
+            for (int i = 0; i < data.getJvmVersions().length; i++) {
+                String version = data.getJvmVersions()[i];
+                createText(doc, config, "jvm-version", version);
+            }
+            for (int i = 0; i < data.getPrerequisites().length; i++) {
+                ConfigurationMetadata.Prerequisite prereq = data.getPrerequisites()[i];
+                writePrerequisite(doc, config, prereq);
+            }
+            for (int i = 0; i < data.getDependencies().length; i++) {
+                String version = data.getDependencies()[i];
+                createText(doc, config, "dependency", version);
+            }
+            for (int i = 0; i < data.getObsoletes().length; i++) {
+                String version = data.getObsoletes()[i];
+                createText(doc, config, "obsoletes", version);
+            }
+        }
+        createText(doc, root, "backup-repository", "http://www.ibiblio.org/maven2/");
+        return doc;
+    }
+
+    private void writePrerequisite(Document doc, Element config, ConfigurationMetadata.Prerequisite data) {
+        Element prereq = doc.createElement("prerequisite");
+        config.appendChild(prereq);
+        createText(doc, prereq, "id", data.getConfigId().toString());
+        createText(doc, prereq, "resource-type",data.getResourceType());
+        createText(doc, prereq, "description",data.getDescription());
+    }
+
+    private void createText(Document doc, Element parent, String name, String text) {
+        Element child = doc.createElement(name);
+        parent.appendChild(child);
+        Text node = doc.createTextNode(text);
+        child.appendChild(node);
+    }
+
+    private static String getText(Node target) {
+        NodeList nodes = target.getChildNodes();
+        StringBuffer buf = null;
+        for(int j=0; j<nodes.getLength(); j++) {
+            Node node = nodes.item(j);
+            if(node.getNodeType() == Node.TEXT_NODE) {
+                if(buf == null) {
+                    buf = new StringBuffer();
+                }
+                buf.append(node.getNodeValue());
+            }
+        }
+        return buf == null ? null : buf.toString();
+    }
+
+    public static void main(String[] args) {
+        try {
+            new PluginRepositoryExporter(args[0], args[1], args[2]).execute();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}

Modified: geronimo/branches/1.1/plugins/geronimo-dependency-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-dependency-plugin/project.xml?rev=396191&r1=396190&r2=396191&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-dependency-plugin/project.xml (original)
+++ geronimo/branches/1.1/plugins/geronimo-dependency-plugin/project.xml Sat Apr 22 18:19:16 2006
@@ -23,7 +23,7 @@
     <id>geronimo-dependency-plugin</id>
     <name>Geronimo :: Maven Dependency Plugin</name>
     <description>A plugin used to construct a geronimo-service.xml dependency list for a Geronimo module</description>
-    <currentVersion>1.1.0-2</currentVersion>
+    <currentVersion>1.1.0-3</currentVersion>
 
     <dependencies>
         <dependency>

Modified: geronimo/branches/1.1/plugins/geronimo-dependency-plugin/src/java/org/apache/geronimo/plugin/dependency/GenerateServiceXml.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-dependency-plugin/src/java/org/apache/geronimo/plugin/dependency/GenerateServiceXml.java?rev=396191&r1=396190&r2=396191&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-dependency-plugin/src/java/org/apache/geronimo/plugin/dependency/GenerateServiceXml.java (original)
+++ geronimo/branches/1.1/plugins/geronimo-dependency-plugin/src/java/org/apache/geronimo/plugin/dependency/GenerateServiceXml.java Sat Apr 22 18:19:16 2006
@@ -33,6 +33,7 @@
 public class GenerateServiceXml {
 
     private static final String DEPENDENCY_PROPERTY = "geronimo.dependency";
+    private static final String KEEP_VERSION_PROPERTY = "geronimo.keep.version";
 
     private List artifacts;
     private String targetDir;
@@ -69,12 +70,14 @@
             if ("true".equals(dependency.getProperty(DEPENDENCY_PROPERTY))) {
                 String groupId = dependency.getGroupId();
                 String artifactId = dependency.getArtifactId();
-//                String version = dependency.getVersion();
                 String type = dependency.getType();
                 org.apache.geronimo.deployment.xbeans.ArtifactType dependencyType = serviceType.addNewDependency();
                 dependencyType.setGroupId(groupId);
                 dependencyType.setArtifactId(artifactId);
-//                dependencyType.setVersion(version);
+                if ("true".equals(dependency.getProperty(KEEP_VERSION_PROPERTY))) {
+                    String version = dependency.getVersion();
+                    dependencyType.setVersion(version);
+                }
                 if (type != null && !"jar".equals(type)) {
                     dependencyType.setType(type);
                 }

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml?rev=396191&r1=396190&r2=396191&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml Sat Apr 22 18:19:16 2006
@@ -22,7 +22,7 @@
     <groupId>geronimo</groupId>
     <id>geronimo-packaging-plugin</id>
     <name>Geronimo :: Maven Packaging Plugin</name>
-    <currentVersion>1.1.0-6</currentVersion>
+    <currentVersion>1.1.0-7</currentVersion>
 
     <dependencies>
         <dependency>

Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java?rev=396191&r1=396190&r2=396191&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java Sat Apr 22 18:19:16 2006
@@ -51,6 +51,7 @@
     private static final String IMPORT_PROPERTY = "geronimo.import";
 //    private static final String INCLUDE_PROPERTY = "geronimo.include";
     private static final String DEPENDENCY_PROPERTY = "geronimo.dependency";
+    private static final String KEEP_VERSION_PROPERTY = "geronimo.keep.version";
     private static final String REFERENCE_PROPERTY = "geronimo.reference";
     private static final String ENVIRONMENT_LOCAL_NAME = "environment";
     private static final QName ENVIRONMENT_QNAME = new QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "environment");
@@ -255,6 +256,9 @@
     private static org.apache.geronimo.kernel.repository.Dependency toGeronimoDependency(Dependency dependency) {
         org.apache.geronimo.kernel.repository.Artifact artifact = toGeronimoArtifact(dependency);
         if ("true".equals(dependency.getProperty(DEPENDENCY_PROPERTY))) {
+            if ("true".equals(dependency.getProperty(KEEP_VERSION_PROPERTY))) {
+                artifact = new org.apache.geronimo.kernel.repository.Artifact(artifact.getGroupId(), artifact.getArtifactId(), dependency.getVersion(), artifact.getType());
+            }
             return new org.apache.geronimo.kernel.repository.Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.CLASSES);
         } else if ("true".equals(dependency.getProperty(REFERENCE_PROPERTY))) {
             return new org.apache.geronimo.kernel.repository.Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.SERVICES);