Maven - Run Maven Java Web Application in Tomcat Maven Plugin - maven tutorial
Introduction
- This guide was written based on:
- Eclipse 4.6 (NEON)
- Tomcat Maven Plugin 2.2
- The steps in this tutorial:
learn maven tutorial - mave java web application in tomcat - maven example
maven tutorial tags : apache maven , maven repository , maven central
Quick create Maven Web Application Project
learn maven tutorial - create maven web application project step1- maven example
learn maven tutorial - create maven web application project step2- maven example
learn maven tutorial - create maven web application project step3- maven example
learn maven tutorial - create maven web application project step4- maven example
learn maven tutorial - create maven web application project step5- maven example
learn maven tutorial - create maven web application project step6- maven example
learn maven tutorial - create maven web application project step7- maven example
Search Tomcat Maven Plugin version to use
- Next we will find a version of "Tomcat Maven Plugin" (fit or newest):
learn maven tutorial - search tomcat maven plugin version to use step1- maven example
learn maven tutorial - search tomcat maven plugin version to use step2- maven example
Configure and run Maven Project
- Configure Maven Servlet Library
- Copy and paste the following code into pom.xml
pom.xml
- Configure Project to run. Right-click on the Project select "Run As / Run Configurations ...".
learn maven tutorial - configure and run maven project step1- maven example
- Create a new run configuration
learn maven tutorial - configure and run maven project step2- maven example
- Enter the information as shown below, click Apply and click Run.
- Run SimpleMavenWebApp
- ${workspace_loc:/SimpleMavenWebApp}
- tomcat7:run -X
learn maven tutorial - configure and run maven project step3- maven example
- In the first run, Eclipse will download "Tomcat Maven Plugin", so you have to wait until the download is complete
learn maven tutorial - configure and run maven project step4- maven example
learn maven tutorial - configure and run maven project step5- maven example
- Copy the link below to run on your browser
- http://localhost:8080/SimpleMavenWebApp
learn maven tutorial - configure and run maven project step6- maven example
- To rerun the WebApplication you will need to close the currently running application.
learn maven tutorial - configure and run maven project step7- maven example
- Run the application again
learn maven tutorial - configure and run maven project step8- maven example