Tuesday, March 4, 2014

Maven - Deploy war in Tomcat 7 & 8

This article will explain on how to deploy a war fine in to Tomcat 7 through maven build.

Note : I have tested same settings for Tomcat 8 as well. So below settings can be apply for both versions.

  • Configure tomcat7-maven-plugin in pom.xml
   <!-- Tomcat plugin -->
     <url>http:// localhost:8080/manager/text</url>

  • Configure user rights in the tomcat-user.xml which is in the tomcat conf file.
   <role rolename="tomcat" />
   <role rolename="manager-gui" />
   <role rolename="manager-script" />
   <role rolename="admin-gui" />
   <user username="tomcat" password="tomcatuser"
    roles="tomcat,manager-gui,admin-gui,manager-script" />
  •  Once above steps are followed, You can deploy the war by running following maven goal
mvn tomcat7:redeploy

More details of the Apache Tomcat Maven Plugin refer maven-plugin-2.2

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.