Skip to content

Commit

Permalink
Fix move from DISTRO to HOME for jetty-maven-plugin mode (#5991)
Browse files Browse the repository at this point in the history
* Use mode EXTERNAL rather than HOME or DISTRO

Signed-off-by: Jan Bartel <janb@webtide.com>
  • Loading branch information
janbartel committed Mar 3, 2021
1 parent 599b476 commit 76580d5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
Expand Up @@ -204,9 +204,9 @@ See link:#container-classpath[Container Classpath vs WebApp Classpath].

===== In a jetty distribution

`deployMode` of `DISTRO`.
`deployMode` of `EXTERNAL`.
This is similar to the old "jetty:run-distro" goal - your webapp is deployed into a dynamically downloaded, unpacked and configured jetty distribution.
A separate process is forked to run the distro.
A separate process is forked to run it.
These extra configuration parameters are available:

jettyBase::
Expand Down Expand Up @@ -234,7 +234,7 @@ These modules are enabled by default: `server,http,webapp,deploy`.
The following configuration parameters are common to all of the `"run-"` and `"start-"` goals:

deployMode::
One of `EMBED`, `FORK` or `DISTRO`.
One of `EMBED`, `FORK` or `EXTERNAL`.
Default `EMBED`.
Can also be configured by setting the Maven property `jetty.deployMode`.
This parameter determines whether the webapp will run in jetty in-process with Maven, forked into a new process, or deployed into a jetty distribution.
Expand Down Expand Up @@ -281,7 +281,7 @@ It will make a classpath for the webapp to be deployed comprised of &lt;dependen

If your production environment places specific jars onto the container's classpath, the equivalent way to do this with maven is to define these as &lt;dependencies&gt; for the _plugin_ itself, not the _project_. See http://maven.apache.org/pom.html#Plugins[configuring maven plugins].
This is suitable if you are using either `EMBED` or `FORK` mode.
If you are using `DISTRO` mode, then you should configure the `modules` parameter with the names of the jetty modules that place these jars onto the container classpath.
If you are using `EXTERNAL` mode, then you should configure the `modules` parameter with the names of the jetty modules that place these jars onto the container classpath.

Note that in `EMBED` or `FORK` mode, you could also influence the container classpath by setting the `useProvidedScope` parameter to `true`: this will place any dependencies with &lt;scope&gt;provided&lt;scope&gt; onto the plugin's classpath.
Use this very cautiously: as the plugin already automatically places most jetty jars onto the classpath, you could wind up with duplicate jars.
Expand Down Expand Up @@ -405,7 +405,7 @@ Include and exclude patterns that can be applied to the testClassesDirectory for
If a file or directory is excluded by the patterns then a change in that file (or subtree in the case of a directory) is ignored and will not cause the webapp to redeploy.
Patterns are specified as a relative path using a glob-like syntax as described in the http://docs.oracle.com/javase/8/docs/api/java/nio/file/FileSystem.html#getPathMatcher-java.lang.String-[javadoc] for http://docs.oracle.com/javase/8/docs/api/java/nio/file/FileSystem.html#getPathMatcher-java.lang.String-[FileSystem.getPathMatcher].

See link:#deployment-modes[Deployment Modes] for other configuration parameters available when using the `run` goal in EMBED, FORK or DISTRO modes.
See link:#deployment-modes[Deployment Modes] for other configuration parameters available when using the `run` goal in EMBED, FORK or EXTERNAL modes.

Here's an example of a pom configuration for the plugin with the `run` goal:

Expand Down Expand Up @@ -507,7 +507,7 @@ scanTargetPatterns::
Optional.
List of directories with ant-style include/excludes patterns to specify other files to periodically scan for changes.

See link:#deployment-modes[Deployment Modes] for other configuration parameters available when using the `run-war` goal in EMBED, FORK or DISTRO modes.
See link:#deployment-modes[Deployment Modes] for other configuration parameters available when using the `run-war` goal in EMBED, FORK or EXTERNAL modes.

[[jetty-start-goal]]
==== jetty:start
Expand Down Expand Up @@ -625,7 +625,7 @@ Optional.
Used in conjunction with stopPort for stopping jetty.
Useful to use in conjunction with the link:#jetty-stop-goal[stop] and link:#jetty-start-goal[start] goals.

These additional configuration parameters are available when running in `FORK` or `DISTRO` mode:
These additional configuration parameters are available when running in `FORK` or `EXTERNAL` mode:

maxChildStartChecks::
Default is `10`.
Expand Down Expand Up @@ -691,7 +691,7 @@ Optional.
Used in conjunction with stopPort for stopping jetty.
Useful to use in conjunction with the link:#jetty-stop-goal[stop].

These additional configuration parameters are available when running in FORK or DISTRO mode:
These additional configuration parameters are available when running in FORK or EXTERNAL mode:

maxChildStartChecks::
Default is `10`.
Expand All @@ -704,7 +704,7 @@ This is the time in milliseconds between checks on the startup of the forked jet
[[jetty-stop-goal]]
==== jetty:stop

The stop goal stops a FORK or DISTRO mode running instance of Jetty.
The stop goal stops a FORK or EXTERNAL mode running instance of Jetty.
To use it, you need to configure the plugin with a special port number and key.
That same port number and key will also be used by the other goals that start jetty.

Expand Down
Expand Up @@ -16,7 +16,7 @@
<properties>
<jetty.port.file>${project.build.directory}/jetty-start-distro-port.txt</jetty.port.file>
<jetty.jvmArgs>@jetty.jvmArgs@</jetty.jvmArgs>
<jetty.deployMode>HOME</jetty.deployMode>
<jetty.deployMode>DISTRO</jetty.deployMode>
</properties>

<dependencies>
Expand Down
Expand Up @@ -72,19 +72,21 @@ public enum DeploymentMode
{
EMBED,
FORK,
HOME
HOME, //alias for EXTERNAL
DISTRO, //alias for EXTERNAL
EXTERNAL
}

/**
* Max number of times to check to see if jetty has started correctly
* when running in FORK or HOME mode.
* when running in FORK or EXTERNAL 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 HOME mode.
* correctly when running in FORK or EXTERNAL mode.
*/
@Parameter (defaultValue = "200")
protected long maxChildStartCheckMs;
Expand Down Expand Up @@ -222,7 +224,7 @@ public enum DeploymentMode
protected Map<String, String> systemProperties;

/**
* Controls how to run jetty. Valid values are EMBED,FORK,HOME.
* Controls how to run jetty. Valid values are EMBED,FORK,EXTERNAL.
*/
@Parameter (property = "jetty.deployMode", defaultValue = "EMBED")
protected DeploymentMode deployMode;
Expand Down Expand Up @@ -267,7 +269,7 @@ public enum DeploymentMode
//End of EMBED only


//Start of parameters only valid for FORK/HOME
//Start of parameters only valid for FORK/EXTERNAL
/**
* Extra environment variables to be passed to the forked process
*/
Expand Down Expand Up @@ -296,9 +298,9 @@ public enum DeploymentMode
*/
@Parameter
protected String stopKey;
//End of FORK or HOME parameters
//End of FORK or EXTERNAL parameters

//Start of parameters only valid for HOME
//Start of parameters only valid for EXTERNAL
/**
* Location of jetty home directory
*/
Expand All @@ -317,7 +319,7 @@ public enum DeploymentMode
*/
@Parameter
protected String[] modules;
//End of HOME only parameters
//End of EXTERNAL only parameters

//Start of parameters only valid for FORK
/**
Expand Down Expand Up @@ -438,8 +440,12 @@ protected void startJetty()
startJettyForked();
break;
}
case DISTRO:
case HOME:
case EXTERNAL:
{
if (deployMode != DeploymentMode.EXTERNAL)
getLog().warn(deployMode + " mode is deprecated, use mode EXTERNAL");
startJettyHome();
break;
}
Expand Down
Expand Up @@ -69,7 +69,7 @@ public class JettyRunMojo extends AbstractUnassembledWebAppMojo

/**
* Only one of the following will be used, depending the mode
* the mojo is started in: EMBED, FORK, HOME
* the mojo is started in: EMBED, FORK, EXTERNAL
*/
protected JettyEmbedder embedder;
protected JettyForker forker;
Expand Down Expand Up @@ -366,8 +366,12 @@ public void restartWebApp(boolean reconfigure) throws Exception
scanner.start();
break;
}
case DISTRO:
case HOME:
case EXTERNAL:
{
if (deployMode != DeploymentMode.EXTERNAL)
getLog().warn(deployMode + " mode is deprecated, use mode EXTERNAL");
verifyPomConfiguration();
if (reconfigure)
{
Expand Down
Expand Up @@ -263,7 +263,11 @@ public void restartWebApp(boolean reconfigure) throws Exception
break;
}
case HOME:
case DISTRO:
case EXTERNAL:
{
if (deployMode != DeploymentMode.EXTERNAL)
getLog().warn(deployMode + " mode is deprecated, use mode EXTERNAL");
verifyPomConfiguration();
if (reconfigure)
{
Expand Down

0 comments on commit 76580d5

Please sign in to comment.