blob: a3fecc84305c5fbc9e2136ececeb03d0507e9711 [file] [log] [blame]
------
Rapid Testing Using the Jetty Plugin
------
Pete Marvin King
------
2008-08-03
------
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
~~ NOTE: For help with the syntax of this file, see:
~~ http://maven.apache.org/doxia/references/apt-format.html
Rapid Testing Using the Jetty Plugin
Normally, testing a web application involves compiling Java sources, creating a WAR and
deploying it to a web container.
Using the Jetty Plugin enables you to quickly test your web application by skipping
the last two steps. By default the Jetty Plugin scans <<<target/classes>>> for
any changes in your Java sources and <<<src/main/webapp>>> for changes to your web sources.
The Jetty Plugin will automatically reload the modified classes and web sources.
To use the Jetty Plugin just add the following in your <<<pom.xml>>>:
+-----------------+
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
...
</plugins>
</build>
...
</project>
+-----------------+
Then start Jetty:
+-----------------+
mvn jetty:run
+-----------------+
The command will block with Jetty listening on port 8080.
Check the {{{http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin}Jetty Plugin documentation}} for more details.