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 2012/09/26 13:49:13 UTC

svn commit: r1390415 - /openejb/trunk/openejb/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java

Author: rmannibucau
Date: Wed Sep 26 11:49:12 2012
New Revision: 1390415

URL: http://svn.apache.org/viewvc?rev=1390415&view=rev
Log:
sh and bat files should be executable if they come from bin directory

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

Modified: openejb/trunk/openejb/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java?rev=1390415&r1=1390414&r2=1390415&view=diff
==============================================================================
--- openejb/trunk/openejb/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java (original)
+++ openejb/trunk/openejb/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java Wed Sep 26 11:49:12 2012
@@ -30,6 +30,8 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
@@ -60,6 +62,7 @@ import static org.apache.maven.artifact.
 import static org.apache.openejb.util.JarExtractor.delete;
 import static org.codehaus.plexus.util.FileUtils.copyDirectory;
 import static org.codehaus.plexus.util.FileUtils.deleteDirectory;
+import static org.codehaus.plexus.util.FileUtils.filename;
 import static org.codehaus.plexus.util.IOUtil.close;
 import static org.codehaus.plexus.util.IOUtil.copy;
 
@@ -278,8 +281,17 @@ public abstract class AbstractTomEEMojo 
         copyLibs(webapps, new File(catalinaBase, webappDir), "war"); // TODO: manage custom context ?context=foo
         copyLibs(apps, new File(catalinaBase, appDir), "jar");
         overrideConf(config);
-        overrideConf(bin);
         overrideConf(lib);
+        final Collection<File> copied = overrideConf(bin);
+
+        for (File copy : copied) {
+            if (copy.getName().endsWith(".bat") || copy.getName().endsWith(".sh")) {
+                if (!copy.setExecutable(true)) {
+                    getLog().warn("can't make " + copy.getPath() + " executable");
+                }
+            }
+        }
+
         if (!keepServerXmlAsthis) {
             overrideAddresses();
         }
@@ -507,13 +519,14 @@ public abstract class AbstractTomEEMojo 
         }
     }
 
-    private void overrideConf(final File dir) {
+    private Collection<File> overrideConf(final File dir) {
         if (!dir.exists()) {
-            return;
+            return Collections.emptyList();
         }
 
         final File[] files = dir.listFiles();
         if (files != null) {
+            final Collection<File> copied = new ArrayList<File>();
             for (final File f : files) {
                 if (f.isHidden()) {
                     continue;
@@ -536,6 +549,7 @@ public abstract class AbstractTomEEMojo 
                         out = new FileOutputStream(destination);
                         copy(in, out);
 
+                        copied.add(f);
                         getLog().info("Override '" + file + "'");
                     } catch (Exception e) {
                         throw new TomEEException(e.getMessage(), e);
@@ -545,7 +559,11 @@ public abstract class AbstractTomEEMojo 
                     }
                 }
             }
+
+            return copied;
         }
+
+        return Collections.emptyList();
     }
 
     protected void run() {