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 war
, one easy way to get the webapp up and running is to use the Maven Jetty Plugin. To do so, simply add the following snippet to your POM:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
</plugin>
...
</plugins>
...
</build>
...
</project>
With this setup, running mvn jetty:run
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 scanIntervalSeconds
option:
scanIntervalSeconds
Optional. 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.
So the configuration might look like:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>
</plugin>
...
</plugins>
...
</build>
...
</project>
And if you want to be able to connect a remote debugger, have a look at these instructions.
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.