You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2015/12/21 09:01:13 UTC

tomee git commit: TOMEE-1682 allow to not have a root folder in tomee zip in tomee maven plugin

Repository: tomee
Updated Branches:
  refs/heads/master 533d794cc -> 6e225af73


TOMEE-1682 allow to not have a root folder in tomee zip in tomee maven plugin


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/6e225af7
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/6e225af7
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/6e225af7

Branch: refs/heads/master
Commit: 6e225af73a40e512d9c01240205c6f2746afa012
Parents: 533d794
Author: Romain Manni-Bucau <rm...@gmail.com>
Authored: Mon Dec 21 09:01:57 2015 +0100
Committer: Romain Manni-Bucau <rm...@gmail.com>
Committed: Mon Dec 21 09:01:57 2015 +0100

----------------------------------------------------------------------
 .../openejb/maven/plugin/AbstractTomEEMojo.java | 21 +++++++++++++-------
 .../maven/plugin/TomEEMavenPluginRule.java      |  1 +
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/6e225af7/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
index 2175a3b..62fe7b5 100644
--- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
+++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
@@ -360,6 +360,11 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo {
      */
     @Parameter(property = "tomee-plugin.override-on-unzip", defaultValue = "true")
     protected boolean overrideOnUnzip;
+    /**
+     * if a file is already there when unpacking tomee zip should it be overriden?
+     */
+    @Parameter(property = "tomee-plugin.skip-root-folder-on-unzip", defaultValue = "true")
+    protected boolean skipRootFolderOnUnzip;
 
     /**
      * the actual path used in server.xml for the https keystore if relevant.
@@ -1411,14 +1416,16 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo {
             while (entries.hasMoreElements()) {
                 final ZipEntry entry = entries.nextElement();
                 String name = entry.getName();
-                int idx = name.indexOf("/");
-                if (idx < 0) {
-                    idx = name.indexOf(File.separator);
-                }
-                if (idx < 0) {
-                    continue;
+                if (skipRootFolderOnUnzip) {
+                    int idx = name.indexOf("/");
+                    if (idx < 0) {
+                        idx = name.indexOf(File.separator);
+                    }
+                    if (idx < 0) {
+                        continue;
+                    }
+                    name = name.substring(idx + 1);
                 }
-                name = name.substring(idx + 1);
                 final File dest = new File(catalinaBase.getAbsolutePath(), name);
                 if (!dest.exists()) {
                     final File parent = dest.getParentFile();

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e225af7/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/TomEEMavenPluginRule.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/TomEEMavenPluginRule.java b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/TomEEMavenPluginRule.java
index 689ccee..2bf5e3e 100644
--- a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/TomEEMavenPluginRule.java
+++ b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/TomEEMavenPluginRule.java
@@ -236,6 +236,7 @@ public class TomEEMavenPluginRule implements MethodRule {
         tomEEMojo.checkStarted = true;
 
         tomEEMojo.overrideOnUnzip = true;
+        tomEEMojo.skipRootFolderOnUnzip = true;
 
         // we mock all the artifact resolution in test
         tomEEMojo.remoteRepos = new LinkedList<ArtifactRepository>();