The way you use Maven, Jetty (and Eclipse) together is unclear, but since the question is marked by Maven, I will talk about the Maven method. With a war project, one easy way to get started and launch webapp is to use the Maven Jetty Plugin . To do this, 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 setting, starting mvn jetty:run will launch the berth container with the application deployed. Any change in presentation will recompile the JSP on request. And to configure the berth plugin to also monitor changes to the Java code, you need to add the scanIntervalSeconds parameter:
scanIntervalSeconds Optional. Pause in seconds between webapp sweeps to check for changes and automatically redeploy automatically if detected. By default, this is 0, which disables the hot deployment scan. A number greater than 0 allows it.
Thus, the configuration may look like this:
<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 connect a remote debugger, check out these instructions .
This is how I always used Jetty with Maven and Eclipse, and I was always happy with this setting. I never used the Jetty adapter for WTP, the previous setup is simply invincible.
Pascal thivent
source share