Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2019-09-10 16:14:06 +10:00
parent 60ee8ac8ee
commit 85719e2287
4 changed files with 11 additions and 21 deletions

View File

@ -259,6 +259,7 @@ public class JettyEmbedder extends AbstractLifeCycle
//regenerate config properties
applyWebAppProperties();
System.err.println("WEbapp is stopped: "+webApp.isStopped());
webApp.start();
}
@ -316,8 +317,6 @@ public class JettyEmbedder extends AbstractLifeCycle
//add the webapp to the server
ServerSupport.addWebApplication(server, webApp);
System.err.println("ADDED WEBAPP TO SERVER");
}
private void applyWebAppProperties () throws Exception
@ -326,7 +325,10 @@ public class JettyEmbedder extends AbstractLifeCycle
if (contextXml != null)
{
if (webAppProperties == null)
{
webAppProperties = new Properties();
webAppProperties.put("context.xml", contextXml);
}
}
WebAppPropertyConverter.fromProperties(webApp, webAppProperties, server, jettyProperties);
}

View File

@ -72,7 +72,6 @@ public class JettyForkedChild extends AbstractLifeCycle
if ("--stop-port".equals(args[i]))
{
jetty.setStopPort(Integer.parseInt(args[++i]));
System.err.println("STOP PORT"+jetty.getStopPort());
continue;
}
@ -80,7 +79,6 @@ public class JettyForkedChild extends AbstractLifeCycle
if ("--stop-key".equals(args[i]))
{
jetty.setStopKey(args[++i]);
System.err.println ("STOP KEY="+jetty.getStopKey());
continue;
}
@ -94,7 +92,6 @@ public class JettyForkedChild extends AbstractLifeCycle
jettyXmls.add(new File(names[j].trim()));
}
jetty.setJettyXmlFiles(jettyXmls);
System.err.println("JETTY XMLS="+jetty.getJettyXmlFiles());
continue;
}
//--webprops
@ -102,7 +99,6 @@ public class JettyForkedChild extends AbstractLifeCycle
{
webAppPropsFile = new File(args[++i].trim());
jetty.setWebAppProperties(loadWebAppProps());
System.err.println("WEBPROPS="+webAppPropsFile);
continue;
}
@ -110,7 +106,6 @@ public class JettyForkedChild extends AbstractLifeCycle
if ("--token".equals(args[i]))
{
tokenFile = new File(args[++i].trim());
System.err.println("TOKEN FILE="+tokenFile);
continue;
}
@ -119,7 +114,6 @@ public class JettyForkedChild extends AbstractLifeCycle
String[] tmp = args[i].trim().split("=");
if (tmp.length == 2)
{
System.err.println("Setting jetty property "+tmp[0]+"="+tmp[1]);
jettyProperties.put(tmp[0], tmp[1]);
}
}
@ -167,9 +161,10 @@ public class JettyForkedChild extends AbstractLifeCycle
{
//stop the webapp
jetty.getWebApp().stop();
System.err.println("STopped the webapp");
//reload the props
jetty.setWebAppProperties(loadWebAppProps());
System.err.println("Reset the webapp properties");
jetty.setWebApp(jetty.getWebApp());
//restart the webapp
jetty.redeployWebApp();
@ -189,7 +184,6 @@ public class JettyForkedChild extends AbstractLifeCycle
if (!Objects.isNull(webAppPropsFile))
scanner.watch(webAppPropsFile.toPath());
scanner.start();
//wait for jetty to finish
@ -197,7 +191,6 @@ public class JettyForkedChild extends AbstractLifeCycle
}
/**
* @param args
* @throws Exception

View File

@ -168,6 +168,7 @@ public class JettyForker extends AbstractForker
{
//regenerating the quickstart will be noticed by the JettyForkedChild process
//which will redeploy the webapp
System.err.println("Redeploying webapp");
generateQuickStart();
}
@ -195,6 +196,7 @@ public class JettyForker extends AbstractForker
//save config of the webapp BEFORE we stop
WebAppPropertyConverter.toProperties(webApp, webAppPropsFile, contextXml);
System.err.println("Generated Quickstart");
}
finally
{

View File

@ -31,7 +31,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.eclipse.jetty.maven.plugin.ConsoleReader;
import org.eclipse.jetty.util.PathWatcher;
import org.eclipse.jetty.util.PathWatcher.PathWatchEvent;
import org.eclipse.jetty.util.resource.Resource;
@ -119,18 +118,13 @@ public class NewJettyRunMojo extends AbstractWebAppMojo
webApp.setBaseResource(originalBaseResource);
if (classesDirectory != null)
{
webApp.setClasses (classesDirectory);
System.err.println("Classes dir="+classesDirectory);
}
else
System.err.println("NO CLASSES DIR");
if (useTestScope && (testClassesDirectory != null))
webApp.setTestClasses (testClassesDirectory);
webApp.setWebInfLib(getProjectDependencyFiles());
//if we have not already set web.xml location, need to set one up
if (webApp.getDescriptor() == null)
{
@ -201,7 +195,6 @@ public class NewJettyRunMojo extends AbstractWebAppMojo
{
try
{
System.err.println("STARTING JETTY FORKED, WAITING FOR CHILD");
forker = newJettyForker();
forker.setWaitForChild(true); //we run at the command line, echo child output and wait for it