Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2019-09-11 15:35:00 +10:00
parent 89ee733f21
commit 2cffd48ab6
5 changed files with 26 additions and 25 deletions

View File

@ -936,7 +936,6 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
{
for (Map.Entry<String, String> e:systemProperties.entrySet())
{
System.err.println(e.getKey() + " " + e.getValue());
System.setProperty(e.getKey(), e.getValue());
}
}

View File

@ -54,7 +54,7 @@ public class ConsoleReader implements Runnable
String line ="";
while (true && line != null)
{
line = console.readLine("Hit <enter> to redeploy:");
line = console.readLine("%nHit <enter> to redeploy:%n%n");
if (line != null)
signalEvent(line);
}

View File

@ -181,6 +181,8 @@ public class JettyDistroForker extends AbstractForker
cmd.add("-jar");
cmd.add(new File(jettyHome, "start.jar").getAbsolutePath());
cmd.add("-Dorg.eclipse.jetty.webapp.LEVEL=DEBUG");
cmd.add("-DSTOP.PORT="+stopPort);
if (stopKey != null)
cmd.add("-DSTOP.KEY="+stopKey);
@ -213,7 +215,7 @@ public class JettyDistroForker extends AbstractForker
tmp.append(",ext");
tmp.append(",maven");
cmd.add(tmp.toString());
//put any jetty properties onto the command line
if (jettyProperties != null)
{

View File

@ -16,7 +16,6 @@
// ========================================================================
//
package org.eclipse.jetty.maven.plugin;
import java.io.File;
@ -47,8 +46,7 @@ import org.eclipse.jetty.util.resource.Resource;
public class JettyEmbedder extends AbstractLifeCycle
{
private static final Logger LOG = Log.getLogger(JettyEmbedder.class);
protected ContextHandler[] contextHandlers;
protected LoginService[] loginServices;
@ -77,11 +75,8 @@ public class JettyEmbedder extends AbstractLifeCycle
private String contextXml;
private Properties webAppProperties;
public ContextHandler[] getContextHandlers()
{
return contextHandlers;
@ -207,13 +202,12 @@ public class JettyEmbedder extends AbstractLifeCycle
this.stopKey = stopKey;
}
public void setWebApp (JettyWebAppContext app)
throws Exception
public void setWebApp(JettyWebAppContext app) throws Exception
{
webApp = app;
}
public void setWebAppProperties (Properties props)
public void setWebAppProperties(Properties props)
{
if (webAppProperties != null)
webAppProperties.clear();
@ -237,8 +231,7 @@ public class JettyEmbedder extends AbstractLifeCycle
this.contextXml = contextXml;
}
public void doStart()
throws Exception
public void doStart() throws Exception
{
super.doStart();
@ -251,8 +244,7 @@ public class JettyEmbedder extends AbstractLifeCycle
server.start();
}
protected void redeployWebApp()
throws Exception
protected void redeployWebApp() throws Exception
{
if (!webApp.isStopped())
webApp.stop();
@ -263,8 +255,7 @@ public class JettyEmbedder extends AbstractLifeCycle
webApp.start();
}
protected void join()
throws InterruptedException
protected void join() throws InterruptedException
{
server.join();
}
@ -274,8 +265,7 @@ public class JettyEmbedder extends AbstractLifeCycle
* Configure the server and the webapp
* @throws Exception
*/
private void configure ()
throws Exception
private void configure() throws Exception
{
/* Configure the server */
//apply any configs from jetty.xml files first
@ -310,7 +300,7 @@ public class JettyEmbedder extends AbstractLifeCycle
//TODO- this might be duplicating WebAppPropertyConverter. make it a quickstart if the quickstart-web.xml file exists
if (webApp.getTempDirectory() != null)
{
File qs = new File (webApp.getTempDirectory(), "quickstart-web.xml");
File qs = new File(webApp.getTempDirectory(), "quickstart-web.xml");
if (qs.exists() && qs.isFile())
{
webApp.setAttribute(QuickStartConfiguration.QUICKSTART_WEB_XML, Resource.newResource(qs));
@ -324,7 +314,7 @@ public class JettyEmbedder extends AbstractLifeCycle
ServerSupport.addWebApplication(server, webApp);
}
private void applyWebAppProperties () throws Exception
private void applyWebAppProperties() throws Exception
{
//apply properties to the webapp if there are any
if (contextXml != null)
@ -337,9 +327,9 @@ public class JettyEmbedder extends AbstractLifeCycle
WebAppPropertyConverter.fromProperties(webApp, webAppProperties, server, jettyProperties);
}
private void configureShutdownMonitor ()
private void configureShutdownMonitor()
{
if(stopPort>0 && stopKey!=null)
if (stopPort > 0 && stopKey != null)
{
ShutdownMonitor monitor = ShutdownMonitor.getInstance();
monitor.setPort(stopPort);

View File

@ -94,8 +94,12 @@ public class WebAppPropertyConverter
Resource baseResource = webApp.getBaseResource();
if (baseResource instanceof ResourceCollection)
props.put("base.dirs", toCSV(((ResourceCollection)webApp.getBaseResource()).getResources()));
else
else if (baseResource instanceof Resource)
props.put("base.dirs", webApp.getBaseResource().toString());
//if there is a war file, use that
if (webApp.getWar() != null)
props.put("war.file", webApp.getWar());
//web-inf classes
if (webApp.getClasses() != null)
@ -204,6 +208,12 @@ public class WebAppPropertyConverter
webApp.setBaseResource(bases);
}
str = webAppProperties.getProperty("war.file");
if (!StringUtil.isBlank(str))
{
webApp.setWar(str);
}
// - the equivalent of web-inf classes
str = webAppProperties.getProperty("classes.dir");
if (!StringUtil.isBlank(str))