diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractForker.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractForker.java
index 9aa7f4772e6..ca04a359bdd 100644
--- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractForker.java
+++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractForker.java
@@ -55,9 +55,9 @@ public abstract class AbstractForker extends AbstractLifeCycle
protected boolean waitForChild;
- protected int maxChildChecks = 10; //check up to 10 times for child to start
+ protected int maxChildStartChecks = 10; //check up to 10 times for child to start
- protected long maxChildCheckInterval = 200; //wait 100ms between checks
+ protected long maxChildStartCheckMs = 200; //wait 200ms between checks
protected File tokenFile;
@@ -195,24 +195,24 @@ public abstract class AbstractForker extends AbstractLifeCycle
this.waitForChild = waitForChild;
}
- public int getMaxChildChecks()
+ public int getMaxChildtartChecks()
{
- return maxChildChecks;
+ return maxChildStartChecks;
}
- public void setMaxChildChecks(int maxChildChecks)
+ public void setMaxChildStartChecks(int maxChildStartChecks)
{
- this.maxChildChecks = maxChildChecks;
+ this.maxChildStartChecks = maxChildStartChecks;
}
- public long getMaxChildCheckInterval()
+ public long getMaxChildStartCheckMs()
{
- return maxChildCheckInterval;
+ return maxChildStartCheckMs;
}
- public void setMaxChildCheckInterval(long maxChildCheckInterval)
+ public void setMaxChildStartCheckMs(long maxChildStartCheckMs)
{
- this.maxChildCheckInterval = maxChildCheckInterval;
+ this.maxChildStartCheckMs = maxChildStartCheckMs;
}
public File getTokenFile()
@@ -242,10 +242,10 @@ public abstract class AbstractForker extends AbstractLifeCycle
else
{
//just wait until the child has started successfully
- int attempts = maxChildChecks;
+ int attempts = maxChildStartChecks;
while (!tokenFile.exists() && attempts > 0)
{
- Thread.currentThread().sleep(maxChildCheckInterval);
+ Thread.currentThread().sleep(maxChildStartCheckMs);
--attempts;
}
if (attempts <= 0)
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 3225dd8a103..5d0695e4158 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
@@ -80,7 +80,19 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
DISTRO
}
+ /**
+ * Max number of times to check to see if jetty has started correctly
+ * when running in FORK or DISTRO mode.
+ */
+ @Parameter (defaultValue = "10")
+ protected int maxChildStartChecks;
+ /**
+ * How long to wait in msec between checks to see if jetty has started
+ * correctly when running in FORK or DISTRO mode.
+ */
+ @Parameter (defaultValue = "200")
+ protected long maxChildStartCheckMs;
/**
* Whether or not to include dependencies on the plugin's classpath with <scope>provided</scope>
* Use WITH CAUTION as you may wind up with duplicate jars/classes.
@@ -192,16 +204,9 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
@Parameter (defaultValue = "${project.baseDir}/src/main/webapp")
protected File webAppSourceDirectory;
- /**
- * List of files or directories to additionally periodically scan for changes. Optional.
- */
- @Parameter
- protected List
@@ -48,7 +46,10 @@ import org.eclipse.jetty.webapp.WebAppContext;
* Once invoked, the plugin can be configured to run continuously, scanning for changes in the project and automatically performing a
* hot redeploy when necessary. This allows the developer to concentrate on coding changes to the project using their IDE of choice and have those changes
* immediately and transparently reflected in the running web container, eliminating development time that is wasted on rebuilding, reassembling and redeploying.
- * Alternatively, you can configure the plugin to wait for an %lt;enter> at the command line to manually control redeployment.
+ * Alternatively, you can configure the plugin to wait for an <enter> at the command line to manually control redeployment.
+ *
+ * You can configure this goal to run your unassembled webapp either in-process with maven, or forked into a new process, or deployed into a
+ * jetty distribution.
*/
@Mojo (name = "run", requiresDependencyResolution = ResolutionScope.TEST)
@Execute (phase = LifecyclePhase.TEST_COMPILE)
@@ -259,7 +260,7 @@ public class JettyRunMojo extends AbstractWebAppMojo
}
//set up any extra files or dirs to watch
- configureScanTargetsAndPatterns(scanner);
+ configureScanTargetPatterns(scanner);
scanner.watch(project.getFile().toPath());
diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java
index f6574b7925b..4ea5a8ec4d2 100644
--- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java
+++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java
@@ -44,7 +44,10 @@ import org.eclipse.jetty.util.StringUtil;
*
* You may also specify the location of a jetty.xml file whose contents will be applied before any plugin configuration.
*
+* You can configure this goal to run your webapp either in-process with maven, or forked into a new process, or deployed into a
+* jetty distribution.
+*
* This goal will NOT scan for changes in either the webapp project or any scanTargets or scanTargetPatterns.
*
+ * You can configure this goal to run your webapp either in-process with maven, or forked into a new process, or deployed into a
+ * jetty distribution.
+ *
- * You must configure the "webApp" element with the location of either a war file or + * You can configure the "webApp" element with the location of either a war file or * an unpacked war that you wish to deploy - in either case, the webapp must be * fully compiled and assembled as this goal does not do anything other than start - * jetty with the given webapp. + * jetty with the given webapp. If you do not configure the "webApp" element, then + * the goal will default to using the war of the webapp project. *
** This goal is designed to be bound to a build phase, and NOT to be run at the @@ -43,6 +44,10 @@ import org.eclipse.jetty.util.StringUtil; * This goal is useful e.g. for launching a web app in Jetty as a target for unit-tested * HTTP client components via binding to the test-integration build phase. *
+ *+ * You can configure this goal to run the webapp either in-process with maven, or + * forked into a new process, or deployed into a jetty distribution. + *
*/ @Mojo(name = "start-war", requiresDependencyResolution = ResolutionScope.RUNTIME) public class JettyStartWarMojo extends AbstractWebAppMojo @@ -92,7 +97,9 @@ public class JettyStartWarMojo extends AbstractWebAppMojo try { forker = newJettyForker(); - forker.setWaitForChild(false); //we never wait for child + forker.setWaitForChild(false); //we never wait for child to finish + forker.setMaxChildStartChecks(maxChildStartChecks); + forker.setMaxChildStartCheckMs(maxChildStartCheckMs); forker.setJettyOutputFile(getJettyOutputFile("jetty-start-war.out")); forker.start(); //forks jetty instance @@ -112,7 +119,9 @@ public class JettyStartWarMojo extends AbstractWebAppMojo try { distroForker = newJettyDistroForker(); - distroForker.setWaitForChild(false); //never wait for child + distroForker.setWaitForChild(false); //never wait for child tofinish + distroForker.setMaxChildStartCheckMs(maxChildStartCheckMs); + distroForker.setMaxChildStartChecks(maxChildStartChecks); distroForker.setJettyOutputFile(getJettyOutputFile("jetty-start-war.out")); distroForker.start(); //forks a jetty distro }