Configuring the Jetty Container
These configuration elements set up the Jetty environment in which your webapp executes. They are common to most goals:
httpConnector
Optional. If not specified, Jetty will create a ServerConnector instance listening on port 8080. You can change this default port number by using the system property jetty.http.port
on the command line, for example, mvn -Djetty.http.port=9999 jetty:run
. Alternatively, you can use this configuration element to set up the information for the ServerConnector. The following are the valid configuration sub-elements:
port
The port number for the connector to listen on. By default it is 8080.
host
The particular interface for the connector to listen on. By default, all interfaces.
name
The name of the connector, which is useful for configuring contexts to respond only on particular connectors.
idleTimeout
Maximum idle time for a connection.
soLinger
The socket linger time.
You could instead configure the connectors in a standard jetty xml config file and put its location into the jettyXml
parameter. Note that since Jetty 9.0 it is no longer possible to configure a https connector directly in the pom.xml: you need to use jetty xml config files to do it.
jettyXml
Optional. A comma separated list of locations of Jetty xml files to apply in addition to any plugin configuration parameters. You might use it if you have other webapps, handlers, specific types of connectors etc., to deploy, or if you have other Jetty objects that you cannot configure from the plugin.
scanIntervalSeconds
The pause in seconds between sweeps of the webapp to check for changes and automatically hot redeploy if any are detected. By default this is 0, which disables hot deployment scanning. A number greater than 0 enables it.
reload
Default value is "automatic", used in conjunction with a non-zero `scanIntervalSeconds` causes automatic hot redeploy when changes are detected. Set to "manual" instead to trigger scanning by typing a linefeed in the console running the plugin. This might be useful when you are doing a series of changes that you want to ignore until you’re done. In that use, use the reload
parameter.
dumpOnStart
Optional. Default value is false. If true, then jetty will dump out the server structure on start.
loginServices
Optional. A list of org.eclipse.jetty.security.LoginService
implementations. Note that there is no default realm. If you use a realm in your web.xml
you can specify a corresponding realm here. You could instead configure the login services in a jetty xml file and add its location to the jettyXml
parameter.
requestLog
Optional. An implementation of the org.eclipse.jetty.server.RequestLog
request log interface. An implementation that respects the NCSA format is available as org.eclipse.jetty.server.NCSARequestLog
. There are three other ways to configure the RequestLog:
- In a jetty xml config file, as specified in the
jettyXml
parameter. - In a context xml config file, as specified in the
contextXml
parameter. - In the
webApp
element.
See Configuring Request Logs for more information.
server
Optional as of Jetty 9.3.1. This would configure an instance of the org.eclipse.jetty.server.Server
for the plugin to use, however it is usually NOT necessary to configure this, as the plugin will automatically configure one for you. In particular, if you use the jettyXml element, then you generally DON’T want to define this element, as you are probably using the jettyXml file to configure up a Server with a special constructor argument, such as a custom threadpool. If you define both a server element AND use a jetty xml element which points to a config file that has a line like <Configure id="Server" class="org.eclipse.jetty.server.Server">
then the the xml configuration will override what you configure for the server in the pom.xml
.
stopPort
Optional. Port to listen on for stop commands. Useful to use in conjunction with the stop or run-forked goals.
stopKey
Optional. Used in conjunction with stopPort for stopping jetty. Useful when used in conjunction with the stop or run-forked goals.
systemProperties
Optional. Allows you to configure System properties for the execution of the plugin. For more information, see Setting System Properties.
systemPropertiesFile
Optional. A file containing System properties to set for the execution of the plugin. By default, settings that you make here do notoverride any system properties already set on the command line, by the JVM, or in the POM via systemProperties
. Read Setting System Properties for how to force overrides.
skip
Default is false. If true, the execution of the plugin exits. Same as setting the SystemProperty -Djetty.skip
on the command line. This is most useful when configuring Jetty for execution during integration testing and you want to skip the tests.
useProvidedScope
Default value is false
. If true, the dependencies with <scope>provided</scope>
are placed onto the container classpath. Be aware that this is NOT the webapp classpath, as "provided" indicates that these dependencies would normally be expected to be provided by the container. You should very rarely ever need to use this. Instead, you should copy the provided dependencies as explicit dependencies of the plugin
instead.
excludedGoals
Optional. A list of Jetty plugin goal names that will cause the plugin to print an informative message and exit. Useful if you want to prevent users from executing goals that you know cannot work with your project.
`<Configure id="Server" class="org.eclipse.jetty.server.Server"> ... <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration"> <Set name="secureScheme"><Property name="jetty.httpConfig.secureScheme" default="https" /></Set> <Set name="securePort"><Property name="jetty.httpConfig.securePort" deprecated="jetty.secure.port" default="8443" /></Set> <Set name="outputBufferSize"><Property name="jetty.httpConfig.outputBufferSize" deprecated="jetty.output.buffer.size" default="32768" /></Set> <Set name="outputAggregationSize"><Property name="jetty.httpConfig.outputAggregationSize" deprecated="jetty.output.aggregation.size" default="8192" /></Set> <Set name="requestHeaderSize"><Property name="jetty.httpConfig.requestHeaderSize" deprecated="jetty.request.header.size" default="8192" /></Set> <Set name="responseHeaderSize"><Property name="jetty.httpConfig.responseHeaderSize" deprecated="jetty.response.header.size" default="8192" /></Set> <Set name="sendServerVersion"><Property name="jetty.httpConfig.sendServerVersion" deprecated="jetty.send.server.version" default="true" /></Set> <Set name="sendDateHeader"><Property name="jetty.httpConfig.sendDateHeader" deprecated="jetty.send.date.header" default="false" /></Set> <Set name="headerCacheSize"><Property name="jetty.httpConfig.headerCacheSize" default="512" /></Set> <Set name="delayDispatchUntilContent"><Property name="jetty.httpConfig.delayDispatchUntilContent" deprecated="jetty.delayDispatchUntilContent" default="true"/></Set> <Set name="maxErrorDispatches"><Property name="jetty.httpConfig.maxErrorDispatches" default="10"/></Set> <Set name="blockingTimeout"><Property name="jetty.httpConfig.blockingTimeout" default="-1"/></Set> <Set name="persistentConnectionsEnabled"><Property name="jetty.httpConfig.persistentConnectionsEnabled" default="true"/></Set> <Set name="cookieCompliance"><Call class="org.eclipse.jetty.http.CookieCompliance" name="valueOf"><Arg><Property name="jetty.httpConfig.cookieCompliance" default="RFC6265"/></Arg></Call></Set>
<!-- Uncomment to enable handling of X-Forwarded- style headers
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
</Call>
-->
</New>
... </Configure> `
原地址 : http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html