How to deploy maven web app application to Tomcat

How to deploy maven web app application to Tomcat

Purpose – To setup a simplewebapp using maven and deploy to tomcat instance


Maven – 3.2.2
Tomcat – 7.0.32
JDK – 1.7.0_55


Step1: Create a simple maven-archetype-webapp project using below command

mvn archetype:generate -Dfilter=maven-archtype-webapp


Step2: Make sure that tomcat is listening on port 8080 and a user is setup for tomcat manager application access

File – <CATALINA_HOME>/conf/tomcat-users.xml

  <role rolename=”manager-gui”/>
  <role rolename=”manager-script”/>
  <user username=”tomcat” password=”tomcat” roles=”manager-gui,manager-script”/>

Verify that the below URL is accessisble with the user id that is configured in tomcat-users.xml file


Step3: Edit the Maven’s settings.xml file with the Tomcat server details as below


Step4: Edit the generated POM file with below tomcat plugin details


Step5: Edit the global web.xml file located at <CATALINA_HOME>/conf/web.xml with below initialization parameter


This change will allow tomcat to accept HTTP put and delete requests which otherwise by default are rejected

Step6: Deploy the maven web application using below command

mvn clean tomcat7:deploy

Step7: Verify the application using below url


Response – Hello World!

Hope you enjoyed reading this article. Thank you.