tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: TOMEE-1638 fixing ExecRunner for script/java usages
Date Tue, 20 Oct 2015 06:48:20 GMT
Repository: tomee
Updated Branches:
  refs/heads/master d68c149c8 -> 009b7f830


TOMEE-1638 fixing ExecRunner for script/java usages


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

Branch: refs/heads/master
Commit: 009b7f83052b0e43c56c0d249e8b169c1636ebd3
Parents: d68c149
Author: Romain Manni-Bucau <rmannibu@gmail.com>
Authored: Tue Oct 20 08:48:07 2015 +0200
Committer: Romain Manni-Bucau <rmannibu@gmail.com>
Committed: Tue Oct 20 08:48:07 2015 +0200

----------------------------------------------------------------------
 .../openejb/maven/plugin/runner/ExecRunner.java | 39 ++++++++++----------
 1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/009b7f83/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
index 44daac3..e858da3 100644
--- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
+++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
@@ -76,23 +76,6 @@ public class ExecRunner {
             IO.writeString(timestampFile, config.getProperty("timestamp", Long.toString(System.currentTimeMillis())));
         }
 
-        final File[] extracted = distribOutput.listFiles();
-        if (extracted != null) {
-            File newRoot = null;
-            for (final File e : extracted) {
-                if (e.isDirectory()) {
-                    if (newRoot == null) {
-                        newRoot = e;
-                    } else {
-                        newRoot = null;
-                        break;
-                    }
-                }
-            }
-            if (newRoot != null) {
-                distribOutput = newRoot;
-            }
-        }
         final File[] scripts = new File(distribOutput, "bin").listFiles();
         if (scripts != null) { // dont use filefilter to avoid dependency issue
             for (final File f : scripts) {
@@ -112,11 +95,11 @@ public class ExecRunner {
                 final boolean isWin = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win");
                 final String script = cmd.substring(lastSlash + 1, cmd.length() - SH_BAT_AUTO.length()).replace('/',
isWin ? '\\' : '/')
                         + (isWin ? ".bat" : ".sh");
-                cmd = dir + File.separator + script;
-                final File scriptFile = new File(distribOutput, cmd);
+                final File scriptFile = new File(distribOutput, dir + File.separator + script);
                 if (!scriptFile.exists()) {
                     throw new IllegalArgumentException("Can't find  " + cmd);
                 }
+                cmd = scriptFile.getAbsolutePath();
                 if (cmd.endsWith(".sh")) {
                     if(!scriptFile.setExecutable(true)){
                         System.err.println("Failed make script file executable: " + scriptFile);
@@ -129,6 +112,24 @@ public class ExecRunner {
 
         final Collection<String> params = new ArrayList<>();
         if ("java".equals(cmd)) {
+            final File[] extracted = distribOutput.listFiles();
+            if (extracted != null) {
+                File newRoot = null;
+                for (final File e : extracted) {
+                    if (e.isDirectory()) {
+                        if (newRoot == null) {
+                            newRoot = e;
+                        } else {
+                            newRoot = null;
+                            break;
+                        }
+                    }
+                }
+                if (newRoot != null) {
+                    distribOutput = newRoot;
+                }
+            }
+
             final QuickServerXmlParser parser = QuickServerXmlParser.parse(new File(distribOutput,"conf/server.xml"));
 
             System.setProperty("openejb.home", distribOutput.getAbsolutePath());


Mime
View raw message