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

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

View File

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

View File

@ -168,6 +168,7 @@ public class JettyForker extends AbstractForker
{ {
//regenerating the quickstart will be noticed by the JettyForkedChild process //regenerating the quickstart will be noticed by the JettyForkedChild process
//which will redeploy the webapp //which will redeploy the webapp
System.err.println("Redeploying webapp");
generateQuickStart(); generateQuickStart();
} }
@ -195,6 +196,7 @@ public class JettyForker extends AbstractForker
//save config of the webapp BEFORE we stop //save config of the webapp BEFORE we stop
WebAppPropertyConverter.toProperties(webApp, webAppPropsFile, contextXml); WebAppPropertyConverter.toProperties(webApp, webAppPropsFile, contextXml);
System.err.println("Generated Quickstart");
} }
finally 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.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope; 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;
import org.eclipse.jetty.util.PathWatcher.PathWatchEvent; import org.eclipse.jetty.util.PathWatcher.PathWatchEvent;
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.Resource;
@ -119,18 +118,13 @@ public class NewJettyRunMojo extends AbstractWebAppMojo
webApp.setBaseResource(originalBaseResource); webApp.setBaseResource(originalBaseResource);
if (classesDirectory != null) if (classesDirectory != null)
{
webApp.setClasses (classesDirectory); webApp.setClasses (classesDirectory);
System.err.println("Classes dir="+classesDirectory);
}
else
System.err.println("NO CLASSES DIR");
if (useTestScope && (testClassesDirectory != null)) if (useTestScope && (testClassesDirectory != null))
webApp.setTestClasses (testClassesDirectory); webApp.setTestClasses (testClassesDirectory);
webApp.setWebInfLib(getProjectDependencyFiles()); webApp.setWebInfLib(getProjectDependencyFiles());
//if we have not already set web.xml location, need to set one up //if we have not already set web.xml location, need to set one up
if (webApp.getDescriptor() == null) if (webApp.getDescriptor() == null)
{ {
@ -201,7 +195,6 @@ public class NewJettyRunMojo extends AbstractWebAppMojo
{ {
try try
{ {
System.err.println("STARTING JETTY FORKED, WAITING FOR CHILD");
forker = newJettyForker(); forker = newJettyForker();
forker.setWaitForChild(true); //we run at the command line, echo child output and wait for it forker.setWaitForChild(true); //we run at the command line, echo child output and wait for it