Running a web project with Jetty
When developing web applications, it is good to have a quick way to check if the application deploys successfully without errors. IDEs allow users to hot-deploy applications. Maven provides a mechanism to quickly run the project using Jetty. Jetty is a popular open source application server that can be used to deploy web projects. The Maven Jetty plugin allows applications to be deployed to Jetty and runs them as part of the Maven build process.
How to do it...
- Open a simple web project (
simple-web-project
). - Run the following Maven command:
mvn org.eclipse.jetty:jetty-maven-plugin:run
- Observe the result:
- Access the web application from the browser by going to
http://localhost:8080
.
How it works...
The Maven Jetty plugin allows web applications to be deployed and tested using Jetty. The run
goal is bound to the package
phase. Maven runs all the phases prior to it. Jetty deploys the webapp from its sources; the webapp does not have to be built into a WAR. It looks...