Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The way you are using Maven, Jetty (and Eclipse) together is unclear but since the question is tagged Maven, I'll cover the Maven way. With a project of type <code>war</code>, one easy way to get the webapp up and running is to use the <a href="http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin" rel="noreferrer"><strong>Maven Jetty Plugin</strong></a>. To do so, simply add the following snippet to your POM:</p> <pre><code>&lt;project&gt; ... &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt; &lt;artifactId&gt;maven-jetty-plugin&lt;/artifactId&gt; &lt;version&gt;6.1.10&lt;/version&gt; &lt;/plugin&gt; ... &lt;/plugins&gt; ... &lt;/build&gt; ... &lt;/project&gt; </code></pre> <p>With this setup, running <code>mvn jetty:run</code> will start a jetty container with your application deployed. Any change on a view will cause the JSP to be recompiled when requested. And to configure the jetty plugin to also watch for Java code changes, you'll have to add the <strong><code>scanIntervalSeconds</code></strong> option:</p> <blockquote> <p><strong><code>scanIntervalSeconds</code></strong> <em>Optional</em>. 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.</p> </blockquote> <p>So the configuration might look like:</p> <pre><code>&lt;project&gt; ... &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt; &lt;artifactId&gt;maven-jetty-plugin&lt;/artifactId&gt; &lt;version&gt;6.1.10&lt;/version&gt; &lt;configuration&gt; &lt;scanIntervalSeconds&gt;1&lt;/scanIntervalSeconds&gt; &lt;/configuration&gt; &lt;/plugin&gt; ... &lt;/plugins&gt; ... &lt;/build&gt; ... &lt;/project&gt; </code></pre> <p>And if you want to be able to connect a remote debugger, have a look at <a href="http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse" rel="noreferrer">these instructions</a>. </p> <p>This is how I've always used Jetty with Maven and Eclipse, and I've always been happy with this setup. I've never used the Jetty adapter for the WTP, the previous setup is just unbeatable.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload