Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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...

  1. Open a simple web project (simple-web-project).

  2. Run the following Maven command:

    mvn org.eclipse.jetty:jetty-maven-plugin:run
    
  3. Observe the result:

  4. 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...