tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1591974 - in /tomee/tomee/trunk: container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
Date Fri, 02 May 2014 17:19:27 GMT
Author: rmannibucau
Date: Fri May  2 17:19:27 2014
New Revision: 1591974

URL: http://svn.apache.org/r1591974
Log:
tolerating tomcat as zip in tomee maven plugin

Modified:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
    tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java?rev=1591974&r1=1591973&r2=1591974&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
Fri May  2 17:19:27 2014
@@ -155,8 +155,12 @@ public class RemoteServer {
                 final File lib = new File(home, "lib");
                 final File webapplib = new File(new File(new File(home, "webapps"), "tomee"),
"lib");
 
-                final File openejbJar = lib("openejb-core", lib, webapplib);
-                final File javaagentJar = lib("openejb-javaagent", lib, webapplib);
+                File javaagentJar = null;
+                try {
+                    javaagentJar = lib("openejb-javaagent", lib, webapplib);
+                } catch (final IllegalStateException ise) {
+                    // no-op
+                }
 
                 final File conf = new File(home, "conf");
                 final File loggingProperties = new File(conf, "logging.properties");
@@ -213,7 +217,9 @@ public class RemoteServer {
                     argsList.add("-Djava.util.logging.config.file=" + loggingProperties.getAbsolutePath());
                 }
 
-                argsList.add("-javaagent:" + javaagentJar.getAbsolutePath());
+                if (javaagentJar != null && javaagentJar.exists()) {
+                    argsList.add("-javaagent:" + javaagentJar.getAbsolutePath());
+                }
 
                 //DMB: If you don't use an array, you get problems with jar paths containing
spaces
                 // the command won't parse correctly
@@ -221,6 +227,7 @@ public class RemoteServer {
 
                 final String[] args;
                 if (!tomcat) {
+                    final File openejbJar = lib("openejb-core", lib, webapplib);
                     final StringBuilder cp = new StringBuilder(openejbJar.getAbsolutePath());
                     if (additionalClasspath != null) {
                         cp.append(ps).append(additionalClasspath);
@@ -365,8 +372,10 @@ public class RemoteServer {
             }
         }
 
-        for (final File dir : dirs) {
-            dumpLibs(dir);
+        if (debug) {
+            for (final File dir : dirs) {
+                dumpLibs(dir);
+            }
         }
         throw new IllegalStateException("Cannot find the " + name + " jar");
     }

Modified: tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java?rev=1591974&r1=1591973&r2=1591974&view=diff
==============================================================================
--- tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
(original)
+++ tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
Fri May  2 17:19:27 2014
@@ -964,16 +964,14 @@ public abstract class AbstractTomEEMojo 
             while (entries.hasMoreElements()) {
                 final ZipEntry entry = entries.nextElement();
                 String name = entry.getName();
-                if (name.startsWith("apache-tomee-") || name.startsWith("apache-openejb-"))
{
-                    int idx = name.indexOf("/");
-                    if (idx < 0) {
-                        idx = name.indexOf(File.separator);
-                    }
-                    if (idx < 0) {
-                        continue;
-                    }
-                    name = name.substring(idx + 1);
+                int idx = name.indexOf("/");
+                if (idx < 0) {
+                    idx = name.indexOf(File.separator);
+                }
+                if (idx < 0) {
+                    continue;
                 }
+                name = name.substring(idx + 1);
                 final File dest = new File(catalinaBase.getAbsolutePath(), name);
                 if (!dest.exists()) {
                     final File parent = dest.getParentFile();
@@ -1018,13 +1016,15 @@ public abstract class AbstractTomEEMojo 
                 }
             }
 
-            final FileWriter writer = new FileWriter(file);
-            final String rootTag = container.toLowerCase(Locale.ENGLISH);
-            writer.write("<?xml version=\"1.0\"?>\n" +
-                "<" + rootTag + ">\n" +
-                "  <Deployments dir=\"apps\" />\n" +
-                "</" + rootTag + ">\n");
-            writer.close();
+            if (file.exists()) {
+                final FileWriter writer = new FileWriter(file);
+                final String rootTag = container.toLowerCase(Locale.ENGLISH);
+                writer.write("<?xml version=\"1.0\"?>\n" +
+                        "<" + rootTag + ">\n" +
+                        "  <Deployments dir=\"apps\" />\n" +
+                        "</" + rootTag + ">\n");
+                writer.close();
+            }
 
             final File appsFolder = new File(catalinaBase, "apps");
             if (!appsFolder.exists() && !appsFolder.mkdirs()) {



Mime
View raw message