Skip to main content
summaryrefslogtreecommitdiffstats
blob: 221bb31f00e1171790d1c1574bf2785d77de7435 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Chapter&nbsp;23.&nbsp;Maven and Jetty</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="jetty-dev-guide.html" title="Part&nbsp;IV.&nbsp;Jetty Development Guide"><link rel="prev" href="http-client-transport.html" title="Pluggable Transports"><link rel="next" href="jetty-maven-plugin.html" title="Configuring the Jetty Maven Plugin"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script>
      hljs.initHighlightingOnLoad();
    </script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small">
            Version: 9.4.1-SNAPSHOT</span></td><td style="width: 50%"><script type="text/javascript">  (function() {
            var cx = '016459005284625897022:obd4lsai2ds';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
            '//www.google.com/cse/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
            })();
          </script><gcse:search></gcse:search></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;23.&nbsp;Maven and Jetty</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="http-client-transport.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;IV.&nbsp;Jetty Development Guide<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="jetty-maven-plugin.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at
          <span class="website">www.webtide.com</span></a></h5><p>
 private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ...
 scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development
      </p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="maven-and-jetty"></a>Chapter&nbsp;23.&nbsp;Maven and Jetty</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="maven-and-jetty.html#jetty-maven-helloworld">Using Maven</a></span></dt><dt><span class="section"><a href="jetty-maven-plugin.html">Configuring the Jetty Maven Plugin</a></span></dt><dt><span class="section"><a href="jetty-maven-scanning.html">Files Scanned by the Jetty Maven Plugin</a></span></dt><dt><span class="section"><a href="jetty-jspc-maven-plugin.html">Jetty Jspc Maven Plugin</a></span></dt></dl></div><p>This chapter explains how to use Jetty with Maven and the Jetty Maven plugin.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="jetty-maven-helloworld"></a>Using Maven</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="maven-and-jetty.html#configuring-embedded-jetty-with-maven">Using Embedded Jetty with Maven</a></span></dt><dt><span class="section"><a href="maven-and-jetty.html#developing-standard-webapp-with-jetty-and-maven">Developing a Standard WebApp with Jetty and Maven</a></span></dt></dl></div><p><a class="link" href="http://maven.apache.org/" target="_top">Apache Maven</a> is a software project management and comprehension tool.
Based on the concept of a project object model (POM), Maven can manage a project&#8217;s build, reporting and documentation from a central piece of information.</p><p>It is an ideal tool to build a web application project, and such projects can use the <a class="link" href="jetty-maven-plugin.html" title="Configuring the Jetty Maven Plugin">jetty-maven-plugin</a> to easily run the web application and save time in development.
You can also use Maven to build, test and run a project which embeds Jetty.</p><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-asterisk" aria-hidden="true"></i> Note</h3><p>Use of Maven and the jetty-maven-plugin is <span class="strong"><strong>not</strong></span> required.
Using Maven for Jetty implementations is a popular choice, but users encouraged to manage their projects in whatever way suits their needs.
Other popular tools include Ant and Gradle.</p></div></blockquote></div><p>First we&#8217;ll have a look at a very simple HelloWorld java application that embeds Jetty, then a simple webapp which makes use of the <a class="link" href="jetty-maven-plugin.html" title="Configuring the Jetty Maven Plugin">jetty-maven-plugin</a> to speed up the development cycle.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuring-embedded-jetty-with-maven"></a>Using Embedded Jetty with Maven</h3></div></div></div><p>To understand the basic operations of building and running against Jetty, first review:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="advanced-embedding.html" title="Chapter&nbsp;21.&nbsp;Embedding">Embedding with Jetty</a></li><li class="listitem"><a class="link" href="advanced-embedding.html#jetty-helloworld" title="Jetty Embedded HelloWorld">Jetty HelloWorld example</a></li></ul></div><p>Maven uses convention over configuration, so it is best to use the project structure Maven recommends.
You can use <span class="emphasis"><em>archetypes</em></span> to quickly setup Maven projects, but we will set up the structure manually for this simple tutorial example:</p><div class="screenexample"><pre class="screen">&gt; mkdir JettyMavenHelloWorld
&gt; cd JettyMavenHelloWorld
&gt; mkdir -p src/main/java/org/example</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="creating-helloworld-class"></a>Creating the HelloWorld Class</h4></div></div></div><p>Use an editor to create the file <code class="literal">src/main/java/org/example/HelloWorld.java</code> with the following contents:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>package org.example;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;

public class HelloWorld extends AbstractHandler
{
    public void handle(String target,
                       Request baseRequest,
                       HttpServletRequest request,
                       HttpServletResponse response)
        throws IOException, ServletException
    {
        response.setContentType("text/html;charset=utf-8");
        response.setStatus(HttpServletResponse.SC_OK);
        baseRequest.setHandled(true);
        response.getWriter().println("&lt;h1&gt;Hello World&lt;/h1&gt;");
    }

    public static void main(String[] args) throws Exception
    {
        Server server = new Server(8080);
        server.setHandler(new HelloWorld());

        server.start();
        server.join();
    }
}</code></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="creating-embedded-pom-descriptor"></a>Creating the POM Descriptor</h4></div></div></div><p>The <code class="literal">pom.xml</code> file declares the project name and its dependencies.
Use an editor to create the file <code class="literal">pom.xml</code> in the <code class="literal">JettyMavenHelloWorld</code> directory with the following contents:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;

  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;org.example&lt;/groupId&gt;
  &lt;artifactId&gt;hello-world&lt;/artifactId&gt;
  &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;name&gt;Jetty HelloWorld&lt;/name&gt;

  &lt;properties&gt;
      &lt;!-- Adapt this to a version found on
           http://central.maven.org/maven2/org/eclipse/jetty/jetty-maven-plugin/
        --&gt;
      &lt;jettyVersion&gt;9.3.9.v20160517&lt;/jettyVersion&gt;
  &lt;/properties&gt;

  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
      &lt;artifactId&gt;jetty-server&lt;/artifactId&gt;
      &lt;version&gt;${jettyVersion}&lt;/version&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;

  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
        &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;1.1&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;&lt;goals&gt;&lt;goal&gt;java&lt;/goal&gt;&lt;/goals&gt;&lt;/execution&gt;
        &lt;/executions&gt;
        &lt;configuration&gt;
          &lt;mainClass&gt;org.example.HelloWorld&lt;/mainClass&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
&lt;/project&gt;</code></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="buildng-and-running-embedded-helloworld"></a>Building and Running Embedded HelloWorld</h4></div></div></div><p>You can now compile and execute the HelloWorld class by using these commands:</p><div class="screenexample"><pre class="screen">&gt; mvn clean compile exec:java</pre></div><p>You can point your browser to <code class="literal">http://localhost:8080</code> to see the <span class="emphasis"><em>Hello World</em></span> page.
You can observe what Maven is doing for you behind the scenes by using the <code class="literal">mvn dependency:tree</code> command, which reveals the transitive dependency resolved and downloaded as:</p><div class="screenexample"><pre class="screen">&gt; mvn dependency:tree
[INFO] Scanning for projects...
...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Jetty HelloWorld 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ hello-world ---
...
[INFO] org.example:hello-world:jar:0.1-SNAPSHOT
[INFO] \- org.eclipse.jetty:jetty-server:jar:9.3.9.v20160517:compile
[INFO]    +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO]    +- org.eclipse.jetty:jetty-http:jar:9.3.9.v20160517:compile
[INFO]    |  \- org.eclipse.jetty:jetty-util:jar:9.3.9.v20160517:compile
[INFO]    \- org.eclipse.jetty:jetty-io:jar:9.3.9.v20160517:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.145 s
[INFO] Finished at: 2016-08-01T13:46:42-04:00
[INFO] Final Memory: 15M/209M
[INFO] ------------------------------------------------------------------------</pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="developing-standard-webapp-with-jetty-and-maven"></a>Developing a Standard WebApp with Jetty and Maven</h3></div></div></div><p>The previous section demonstrated how to use Maven with an application that embeds Jetty.
Now we will examine instead how to develop a standard webapp with Maven and Jetty.
First create the Maven structure (you can use the maven webapp archetype instead if you prefer):</p><div class="screenexample"><pre class="screen">&gt; mkdir JettyMavenHelloWarApp
&gt; cd JettyMavenHelloWebApp
&gt; mkdir -p src/main/java/org/example
&gt; mkdir -p src/main/webapp/WEB-INF</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="creating-servlet"></a>Creating a Servlet</h4></div></div></div><p>Use an editor to create the file <code class="literal">src/main/java/org/example/HelloServlet.java</code> with the following contents:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>package org.example;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet extends HttpServlet
{
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        response.setContentType("text/html");
        response.setStatus(HttpServletResponse.SC_OK);
        response.getWriter().println("&lt;h1&gt;Hello Servlet&lt;/h1&gt;");
        response.getWriter().println("session=" + request.getSession(true).getId());
    }
}</code></pre><p>You need to declare this servlet in the deployment descriptor, so create the file <code class="literal">src/main/webapp/WEB-INF/web.xml</code> and add the following contents:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;web-app
   xmlns="http://xmlns.jcp.org/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
   metadata-complete="false"
   version="3.1"&gt;

  &lt;servlet&gt;
    &lt;servlet-name&gt;Hello&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.example.HelloServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;Hello&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/hello/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;

&lt;/web-app&gt;</code></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="creating-plugin-pom-descriptor"></a>Creating the POM Descriptor</h4></div></div></div><p>The <code class="literal">pom.xml</code> file declares the project name and its dependencies.
Use an editor to create the file <code class="literal">pom.xml</code> with the following contents in the <code class="literal">JettyMavenHelloWarApp</code> directory, noting particularly the declaration of the <a class="link" href="jetty-maven-plugin.html" title="Configuring the Jetty Maven Plugin">jetty-maven-plugin</a>:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;

  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;org.example&lt;/groupId&gt;
  &lt;artifactId&gt;hello-world&lt;/artifactId&gt;
  &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;name&gt;Jetty HelloWorld WebApp&lt;/name&gt;

  &lt;properties&gt;
      &lt;jettyVersion&gt;9.4.1-SNAPSHOT&lt;/jettyVersion&gt;
  &lt;/properties&gt;

  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
      &lt;version&gt;3.1.0&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;

  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
        &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;${jettyVersion}&lt;/version&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;

&lt;/project&gt;</code></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="building-and-running-web-application"></a>Building and Running the Web Application</h4></div></div></div><p>Now you can both build and run the web application without needing to assemble it into a war by using the <a class="link" href="jetty-maven-plugin.html" title="Configuring the Jetty Maven Plugin">jetty-maven-plugin</a> via the command:</p><div class="screenexample"><pre class="screen">&gt; mvn jetty:run</pre></div><p>You can see the static and dynamic content at <code class="literal">http://localhost:8080/hello</code></p><p>There are a great deal of configuration options available for the jetty-maven-plugin to help you build and run your webapp.
The full reference is at <a class="link" href="jetty-maven-plugin.html" title="Configuring the Jetty Maven Plugin">Configuring the Jetty Maven Plugin</a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="building-war-file"></a>Building a WAR file</h4></div></div></div><p>You can create a Web Application Archive (WAR) file from the project with the command:</p><div class="screenexample"><pre class="screen">&gt; mvn package</pre></div><p>The resulting war file is in the <code class="literal">target</code> directory and may be deployed on any standard servlet server, including <a class="link" href="configuring-deployment.html" title="Chapter&nbsp;4.&nbsp;Deploying to Jetty">Jetty</a>.</p></div></div></div></div><script type="text/javascript">
      SyntaxHighlighter.all()
    </script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="http-client-transport.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="jetty-dev-guide.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="jetty-maven-plugin.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Pluggable Transports&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top">&nbsp;Configuring the Jetty Maven Plugin</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout">
            See an error or something missing?
            <span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at
                <span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2017-01-07)</i></span></div></p><script xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1149868-7']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
    </script></body></html>

Back to the top