Skip to content

Commit 819211f

Browse files
committed
Rollup of all deploy changes from PR #12583
2 parents 882d066 + 257e1f7 commit 819211f

File tree

215 files changed

+7233
-8112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+7233
-8112
lines changed

documentation/jetty/modules/operations-guide/pages/deploy/index.adoc

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,57 @@
1313

1414
= Web Application Deployment
1515

16-
Most of the time you want to be able to customize the deployment of your web applications, for example by changing the `contextPath`, or by adding JNDI entries, or by configuring virtual hosts, etc.
16+
The Jetty Web Application Deployment mechanism provides for:
17+
18+
* the discovery of Web Applications to deploy (e.g. war files, directories or Jetty XML descriptors)
19+
* determination of default values for key configurations (e.g. contextPath, environment, resource base, temporary directory, etc.)
20+
* optional extraction of archived resources (e.g. war files and jar files)
21+
* the discovery of associated configuration files (e.g. properties and XML files) that can be used to customize the deployment (e.g. changing the `contextPath`, or by adding JNDI entries, or by configuring virtual hosts, etc.). The association may be by application or by environment.
22+
* optional monitoring of all discovered files for hot deployment and/or undeployment.
1723

1824
Jetty supports the deployment of each web application to a specific _environment_.
1925
The available environments are:
2026

21-
* Java EE 8 -- Supports Servlet 4.0 (and associated specifications) in the `+javax.*+` packages.
22-
* Jakarta EE 9 -- Supports Servlet 5.0 (and associated specifications) in the `+jakarta.*+` packages.
23-
* Jakarta EE 10 -- Supports Servlet 6.0 (and associated specifications) in the `+jakarta.*+` packages.
24-
* Jetty Core -- Supports web applications written against the Jetty `Handler` APIs, without any Servlet dependencies.
27+
* Jetty Core -- Supports web applications written against the Jetty `Handler` APIs, without any Servlet dependencies.
28+
* Java EE 8 -- Supports Servlet 4.0 (and associated specifications) in the `+javax.*+` packages.
29+
* Jakarta EE 9 -- Supports Servlet 5.0 (and associated specifications) in the `+jakarta.*+` packages.
30+
* ...
31+
* Jakarta {ee-current-caps} -- Supports latest Servlet (and associated specifications) in the `+jakarta.*+` packages.
2532

26-
This means that you can simultaneously deploy an old Java EE 8 web application, say `old-ee8.war`, alongside a new Jakarta {ee-current-caps} web application, say `new-{ee-current}.war`, alongside a web application that only uses the Jetty `Handler` APIs, say `app-jetty.xml`.
33+
This means that you can simultaneously deploy an old Java EE 8 web application, say `old-ee8.war`, alongside a new Jakarta {ee-current-caps} web application, say `new-{ee-current}.war`, alongside a web application that only uses the core Jetty `Handler` APIs, say `app-jetty.xml`.
2734

2835
The customization of the deployment (for example, web application context path, etc.) is performed by processing <<jetty,Jetty context XML files>>.
2936

30-
The `deploy` module contains the `DeploymentManager` component that scans the `$JETTY_BASE/webapps` directory for changes, following the deployment rules described in <<rules,this section>>.
37+
The `deployment-scanner` module contains the `DeploymentScanner` component that scans the `$JETTY_BASE/webapps` and `$JETTY_BASE/environments` directories for changes, following the deployment rules described in <<rules,this section>>.
3138

32-
For each specific environment there is a specific deploy module that you must enable:
39+
For each specific environment there is a specific deploy module that also must be enabled:
3340

34-
* For Java EE 8, xref:modules/standard.adoc#eeN-deploy[`ee8-deploy`]
35-
* For Java EE 9, xref:modules/standard.adoc#eeN-deploy[`ee9-deploy`]
36-
* For Java {ee-current-caps}, xref:modules/standard.adoc#eeN-deploy[`{ee-current}-deploy`]
37-
* For Jetty Core, xref:modules/standard.adoc#core-deploy[`core-deploy`]
41+
* For Jetty Core, xref:modules/standard.adoc#core-deploy[`core-deploy`]
42+
* For Java EE 8, xref:modules/standard.adoc#eeN-deploy[`ee8-deploy`]
43+
* ...
44+
* For Jakarta {ee-current-caps}, xref:modules/standard.adoc#eeN-deploy[`{ee-current}-deploy`]
3845

3946
Each of these modules provide the environment specific features, and depend on the `deploy` module that provides the scanning features.
4047

48+
By default, deployment uses the `deployer-standard` module, which provides the `StandardDeployer`, which is used by the scanner to deploy individual Web Applications in a way that allows listeners to be bound to deployment trigger points in a defined deployment lifecycle.
49+
4150
[[hot-static]]
4251
== Hot vs Static Deployment
4352

44-
The `DeploymentManager` scans the `$JETTY_BASE/webapps` directory for changes every `N` seconds, where `N` is configured via the `jetty.deploy.scanInterval` property.
53+
The `DeploymentScanner` scans the `$JETTY_BASE/webapps` and `$JETTY_BASE/environments` directories for changes every `N` seconds, where `N` is configured via the `jetty.deploy.scanInterval` property.
4554

46-
By default, the scan interval is `0` seconds, which means _static_ deployment, and the `DeploymentManager` will not scan the `$JETTY_BASE/webapps` directory for changes.
55+
By default, the scan interval is `0` seconds, which means _static_ deployment, and the `DeploymentScanner` will not scan the `$JETTY_BASE/webapps` directory for changes.
4756
This means that to deploy/redeploy/undeploy a web application you will need to stop and restart Jetty.
4857

49-
Setting the scan interval to a value of `1` second (or greater) means that _hot_ deployment is enabled: if a file is added/changed/removed from the `$JETTY_BASE/webapps` directory, the `DeploymentManager` will notice the change and respectively deploy/redeploy/undeploy the web application.
58+
Setting the scan interval to a value of `1` second (or greater) means that _hot_ deployment is enabled: if a file is added/changed/removed from the `$JETTY_BASE/webapps` directory, the `DeplymentScanner` will notice the change and respectively deploy/redeploy/undeploy the web application; and if a file is added/changed/removed from the `$JETTY_BASE/environments` directory, the `DeploymentScanner` will deploy/redeploy all web applications in that environment.
5059

5160
The following command line enables _hot_ deployment by specifying the `jetty.deploy.scanInterval` property on the command line, and therefore only for this particular run:
5261

5362
----
5463
$ java -jar $JETTY_HOME/start.jar jetty.deploy.scanInterval=1
5564
----
5665

57-
To make _hot_ deployment persistent, you need to edit the appropriate `<env>-deploy` module configuration file, `$JETTY_BASE/start.d/<env>-deploy.ini` (eg: `ee11-deploy.ini`), uncomment the module property `jetty.deploy.scanInterval` and change the value to `1` second (or greater):
66+
To make _hot_ deployment configuration persistent, you need to edit the appropriate `<env>-deploy` module configuration file, `$JETTY_BASE/start.d/<env>-deploy.ini` (eg: `ee11-deploy.ini`), uncomment the module property `jetty.deploy.scanInterval` and change the value to `1` second (or greater):
5867

5968
.<env>-deploy.ini
6069
[source,subs=+quotes]
@@ -67,16 +76,16 @@ To make _hot_ deployment persistent, you need to edit the appropriate `<env>-dep
6776
[[rules]]
6877
== Deployment Rules
6978

70-
_Adding_ a `+*.war+` file, a `+*.war+` directory, a Jetty context XML file or a normal directory to `$JETTY_BASE/webapps` causes the `DeploymentManager` to deploy the new web application.
79+
_Adding_ a `+*.war+` file, a `+*.war+` directory, a Jetty context XML file or a normal directory to `$JETTY_BASE/webapps` causes the `DeploymentScanner` to deploy the new web application.
7180

72-
_Updating_ a `+*.war+` file or a Jetty context XML file causes the `DeploymentManager` to redeploy the web application, which means that the Jetty context component representing the web application is stopped, then reconfigured, and then restarted.
81+
_Updating_ a `+*.war+` file or a Jetty context XML file causes the `DeploymentScanner` to redeploy the web application, which means that the Jetty context component representing the web application is stopped, then reconfigured, and then restarted.
7382

74-
_Removing_ a `+*.war+` file, a `+*.war+` directory, a Jetty context XML file or a normal directory from `$JETTY_BASE/webapps` causes the `DeploymentManager` to undeploy the web application, which means that the Jetty context component representing the web application is stopped and removed from the Jetty server.
83+
_Removing_ a `+*.war+` file, a `+*.war+` directory, a Jetty context XML file or a normal directory from `$JETTY_BASE/webapps` causes the `DeploymentScanner` to undeploy the web application, which means that the Jetty context component representing the web application is stopped and removed from the Jetty server.
7584

7685
[[rules-context-path]]
7786
=== Context Path Resolution
7887

79-
When a file or directory is added to `$JETTY_BASE/webapps`, the `DeploymentManager` derives the web application `contextPath` from the file or directory name, with the following rules:
88+
When a file or directory is added to `$JETTY_BASE/webapps`, the `DeploymentScanner` derives the web application `contextPath` from the file or directory name, with the following rules:
8089

8190
* If the directory name is, for example, `mywebapp/`, it is deployed as a standard web application if it contains a `WEB-INF/` subdirectory, otherwise it is deployed as a web application of static content.
8291
The `contextPath` would be `/mywebapp` (that is, the web application is reachable at `+http://localhost:8080/mywebapp/+`).
@@ -130,7 +139,7 @@ This unspecified deployment may not work as the EE 9 web application may use API
130139

131140
A Jetty context XML file is a xref:xml/index.adoc[Jetty XML file] that allows you to customize the deployment of web applications.
132141

133-
NOTE: Recall that the `DeploymentManager` component of the Jetty `deploy` module <<rules,gives priority>> to Jetty context XML files over `+*.war+` files or directories.
142+
NOTE: Recall that the `DeploymentScanner` component of the Jetty `deployment-scanner` module <<rules,gives priority>> to Jetty context XML files over `+*.war+` files or directories.
134143

135144
To deploy a web application using a Jetty context XML file, simply place the file in the `$JETTY_BASE/webapps` directory.
136145

@@ -177,7 +186,7 @@ $JETTY_BASE
177186

178187
TIP: The `+*.war+` file may be placed anywhere in the file system and does not need to be placed in the `$JETTY_BASE/webapps` directory.
179188

180-
IMPORTANT: If you place both the Jetty context XML file _and_ the `+*.war+` file in the `$JETTY_BASE/webapps` directory, remember that they must have the same file name, for example `wiki.xml` and `wiki.war`, so that the `DeploymentManager` deploys the web application only once using the Jetty context XML file (and not the `+*.war+` file).
189+
IMPORTANT: If you place both the Jetty context XML file _and_ the `+*.war+` file in the `$JETTY_BASE/webapps` directory, remember that they must have the same file name, for example `wiki.xml` and `wiki.war`, so that the `DeploymentScanner` deploys the web application only once using the Jetty context XML file (and not the `+*.war+` file).
181190

182191
You can use the features of xref:xml/index.adoc[Jetty XML files] to avoid to hard-code file system paths or other configurations in your Jetty context XML files, for example by using system properties:
183192

@@ -206,7 +215,7 @@ xref:xml/index.adoc[Jetty context XML file] files can be applied to _all_ webapp
206215

207216
Add a properties file to the deployment directory that contains a property naming the location of the xml file to apply.
208217
The properties file name must be prefixed by the name of the `environment`.
209-
For example `ee8.properties, ee8-more.properties ee8-other.properties` would all apply to all contexts deployed in the `ee8` environment.
218+
For example `$JETTY_BASE/environments/ee8.properties`, `$JETTY_BASE/environments/ee8-more.properties` and `$JETTY_BASE/environments/ee8-other.properties` would all apply to all contexts deployed in the `ee8` environment.
210219

211220
If the property file(s) contain one or more properties whose names are prefixed with `org.eclipse.jetty.deploy.environmentXml`, then their values are used as additional context XML files to apply to all contexts deployed in the corresponding environment.
212221
So for example `org.eclipse.jetty.deploy.environmentXml, org.eclipse.jetty.deploy.environmentXml.more, org.eclipse.jetty.deploy.environmentXml.other` are all acceptable as names.
@@ -219,6 +228,8 @@ The order in which they are applied is determined by _the name of the properties
219228

220229
IMPORTANT: The contents of the environment specific context XML file may only contain references to classes appropriate for that environment.
221230

231+
The `core-environment`, `ee8-environment`, ..., and `{ee-current}-environment` modules, each create template configuration files for the appropriate environment in the `$JETTY_BASE/environments/` directory.
232+
222233
For example, given the previous example of a `$JETTY_BASE/webapps/wiki.xml` and its accompanying `$JETTY_BASE/webapps/wiki.properties` file that declares the `wiki` webapp should be deployed to environment `{ee-current}`, files called `$JETTY_BASE/webapps/{ee-current}.properties` and `$JETTY_BASE/webapps/{ee-current}-feature.properties` can be defined to further configure the webapp.
223234

224235
The `{ee-current}.properties` file contains:

documentation/jetty/modules/operations-guide/pages/modules/standard.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ include::{jetty-home}/modules/console-capture.mod[tags=documentation]
142142

143143
include::{jetty-home}/modules/ee11-deploy.mod[tags=description]
144144

145-
Deployment is managed via a `DeploymentManager` component that watches a directory for changes.
145+
Deployment is managed via a `DeploymentScanner` component that watches a directory for changes.
146146
See xref:deploy/index.adoc[how to deploy web applications] for more information.
147147

148148
TODO
@@ -216,10 +216,10 @@ include::{jetty-home}/modules/eager-content.mod[tags=documentation]
216216

217217
include::{jetty-home}/modules/ee11-deploy.mod[tags=description]
218218

219-
Deployment is managed via a `DeploymentManager` component that watches a directory for changes.
219+
Deployment is managed via a `DeploymentScanner` component that watches a directory for changes.
220220
See xref:deploy/index.adoc[how to deploy web applications] for more information.
221221

222-
Adding files or directories to this monitored directory will cause the `DeploymentManager` to deploy them as web applications; updating files already existing in this monitored directory will cause the `DeploymentManager` to re-deploy the corresponding web application; removing files in this monitored directory will cause the `DeploymentManager` to "undeploy" the corresponding web application.
222+
Adding files or directories to this monitored directory will cause the `DeploymentScanner` to deploy them as web applications; updating files already existing in this monitored directory will cause the `DeploymentScanner` to re-deploy the corresponding web application; removing files in this monitored directory will cause the `DeploymentScanner` to "undeploy" the corresponding web application.
223223
(You can find a more detailed discussion of these rules in the xref:deploy/index.adoc#rules[deployment rules] section.)
224224

225225
Multiple versions of this module exist (`{ee-all}-deploy`) to support each Jakarta EE platform's version of the Java Servlet specification.
@@ -234,7 +234,7 @@ Among the configurable properties, the most relevant are:
234234
`jetty.deploy.monitoredDir`::
235235
The name of the monitored directory.
236236
`jetty.deploy.scanInterval`::
237-
The scan period in seconds, that is how frequently the `DeploymentManager` wakes up to scan the monitored directory for changes.
237+
The scan period in seconds, that is how frequently the `DeploymentScanner` wakes up to scan the monitored directory for changes.
238238
Setting `jetty.deploy.scanInterval=0` disabled _hot_ deployment so that only static deployment will be possible (see also xref:deploy/index.adoc#hot-static[here] for more information).
239239

240240
[[eeN-webapp]]

jetty-core/jetty-deploy/pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@
4444
<artifactId>jetty-slf4j-impl</artifactId>
4545
<scope>test</scope>
4646
</dependency>
47+
<dependency>
48+
<!-- Using as ZIP to avoid having classes and dependencies live in test classloader -->
49+
<groupId>org.eclipse.jetty</groupId>
50+
<artifactId>jetty-test-core-example-webapp</artifactId>
51+
<version>${project.version}</version>
52+
<classifier>core-webapp</classifier>
53+
<type>zip</type>
54+
<scope>test</scope>
55+
</dependency>
4756
<dependency>
4857
<groupId>org.eclipse.jetty.toolchain</groupId>
4958
<artifactId>jetty-test-helper</artifactId>
@@ -53,6 +62,35 @@
5362

5463
<build>
5564
<plugins>
65+
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
67+
<artifactId>maven-dependency-plugin</artifactId>
68+
<executions>
69+
<execution>
70+
<id>copy-core-webapps</id>
71+
<goals>
72+
<goal>copy-dependencies</goal>
73+
</goals>
74+
<phase>generate-resources</phase>
75+
<configuration>
76+
<includeClassifiers>core-webapp</includeClassifiers>
77+
<includeTypes>zip</includeTypes>
78+
<outputDirectory>${project.build.directory}/core-webapps/</outputDirectory>
79+
<overWriteReleases>false</overWriteReleases>
80+
<overWriteSnapshots>true</overWriteSnapshots>
81+
<stripClassifier>true</stripClassifier>
82+
<stripVersion>true</stripVersion>
83+
</configuration>
84+
</execution>
85+
</executions>
86+
</plugin>
87+
<plugin>
88+
<groupId>org.apache.maven.plugins</groupId>
89+
<artifactId>maven-javadoc-plugin</artifactId>
90+
<configuration>
91+
<excludePackageNames>*.internal,*.internal.*</excludePackageNames>
92+
</configuration>
93+
</plugin>
5694
<plugin>
5795
<artifactId>maven-surefire-plugin</artifactId>
5896
<configuration>

jetty-core/jetty-deploy/src/main/config/etc/jetty-core-deploy.xml

Lines changed: 0 additions & 37 deletions
This file was deleted.

jetty-core/jetty-deploy/src/main/config/etc/jetty-deploy.xml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)