diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractWebAppMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractWebAppMojo.java index aadf498bf97..82f7ec887d0 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractWebAppMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractWebAppMojo.java @@ -936,7 +936,6 @@ public abstract class AbstractWebAppMojo extends AbstractMojo { for (Map.Entry e:systemProperties.entrySet()) { - System.err.println(e.getKey() + " " + e.getValue()); System.setProperty(e.getKey(), e.getValue()); } } diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ConsoleReader.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ConsoleReader.java index d3800ebb069..d8f0a076792 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ConsoleReader.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ConsoleReader.java @@ -54,7 +54,7 @@ public class ConsoleReader implements Runnable String line =""; while (true && line != null) { - line = console.readLine("Hit to redeploy:"); + line = console.readLine("%nHit to redeploy:%n%n"); if (line != null) signalEvent(line); } diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDistroForker.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDistroForker.java index 8c244ee2c0e..67593f22563 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDistroForker.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDistroForker.java @@ -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) { diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEmbedder.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEmbedder.java index 80f7ad435e9..b1748579cf7 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEmbedder.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEmbedder.java @@ -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); diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/WebAppPropertyConverter.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/WebAppPropertyConverter.java index 29b656b45f7..ae96a513d33 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/WebAppPropertyConverter.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/WebAppPropertyConverter.java @@ -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))