You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:26:25 UTC

[sling-slingstart-maven-plugin] 14/18: SLING-4620 : Slingstart plugin start goal exits even if launchpad.keep.running is set to true

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag slingstart-maven-plugin-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-slingstart-maven-plugin.git

commit fd065bed1d12c8173b4b10789bd31beed0e2d266
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 15 01:19:27 2015 +0000

    SLING-4620 : Slingstart plugin start goal exits even if launchpad.keep.running is set to true
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/slingstart-maven-plugin@1673601 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                        |  2 +-
 .../java/org/apache/sling/maven/slingstart/launcher/Main.java  |  2 ++
 .../apache/sling/maven/slingstart/run/LauncherCallable.java    | 10 ++++++----
 .../java/org/apache/sling/maven/slingstart/run/StartMojo.java  |  4 ++++
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index d168fec..74e0983 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
     </description>
 
     <properties>
-        <sling.java.version>6</sling.java.version>
+        <sling.java.version>7</sling.java.version>
         <maven.version>3.0.5</maven.version>
     </properties>
 
diff --git a/src/main/java/org/apache/sling/maven/slingstart/launcher/Main.java b/src/main/java/org/apache/sling/maven/slingstart/launcher/Main.java
index 3a72704..059e97f 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/launcher/Main.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/launcher/Main.java
@@ -21,6 +21,7 @@ import java.lang.management.ManagementFactory;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Arrays;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -76,6 +77,7 @@ public class Main {
             System.out.println("Slingstart application: " + this.appJar);
             System.out.println("Main class: " + MAIN_CLASS_DEF);
             System.out.println("Listener Port: " + String.valueOf(this.listenerPort));
+            System.out.println("Arguments: " + Arrays.toString(this.startupArgs));
             System.out.println(DELIM);
         }
 
diff --git a/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java b/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java
index 85fd3fc..dcd62d5 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java
@@ -23,6 +23,7 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
+import java.lang.ProcessBuilder.Redirect;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.util.ArrayList;
@@ -164,18 +165,19 @@ public class LauncherCallable implements Callable<ProcessDescription> {
         }
 
         if ( this.configuration.getControlPort() != null ) {
-            args.add("-c");
+            args.add("-j");
             args.add(this.configuration.getControlPort());
         }
-        if ( this.configuration.getRunmode() != null ) {
+        if ( this.configuration.getRunmode() != null && this.configuration.getRunmode().length() > 0 ) {
             args.add("-Dsling.run.modes=" + this.configuration.getRunmode());
         }
+        args.add("start");
 
         builder.command(args.toArray(new String[args.size()]));
         builder.directory(this.configuration.getFolder());
         builder.redirectErrorStream(true);
-//        builder.redirectOutput(Redirect.INHERIT);
-//        builder.redirectError(Redirect.INHERIT);
+        builder.redirectOutput(Redirect.INHERIT);
+        builder.redirectError(Redirect.INHERIT);
 
         logger.info("Starting Launchpad " + this.configuration.getId() +  "...");
         logger.debug("Launchpad cmd: " + builder.command());
diff --git a/src/main/java/org/apache/sling/maven/slingstart/run/StartMojo.java b/src/main/java/org/apache/sling/maven/slingstart/run/StartMojo.java
index e496d58..36bad60 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/run/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/run/StartMojo.java
@@ -342,6 +342,10 @@ public class StartMojo extends AbstractMojo {
             launchpadConfiguration.setPort(String.valueOf(PortHelper.getNextAvailablePort()));
         }
 
+        if ( launchpadConfiguration.getControlPort() == null ) {
+            launchpadConfiguration.setControlPort(String.valueOf(PortHelper.getNextAvailablePort()));
+        }
+
         // set the id of the launchpad
         if ( launchpadConfiguration.getId() == null || launchpadConfiguration.getId().trim().length() == 0 ) {
             String runMode = launchpadConfiguration.getRunmode();

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.