Maven script for deploying project to Apache Tomcat on Amazon EC2

In the Deploying web application on remote tomcat post i listed steps for creating maven script that can install web application on remote Apache Tomcat. You could use the same concept to deploy web applications to Apache Tomcat running on Amazon EC2, by following these steps
  1. First change the tomcat-users.xml to add tomcatadmin user and give him manager-gui and manager-script roles
    <?xml version='1.0' encoding='utf-8'?>
    <role rolename="tomcat"/>
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
    <user username="tomcatadmin" password="tomcatadmin" roles="tomcat,manager-gui,manager-script"/>
    <user username="both" password="tomcat" roles="tomcat"/>
    <user username="role1" password="tomcat" roles="role1"/>
  2. Next change your <MVN_HOME>/settings.xml file to add AWSServer server with tomcatadmin as username passowrd, you shoudl use the user id password that you set in your tomcat-users.xml file here
  3. Last step is to add following plugin to you pom.xml, in this value of url will be the ec2 instance DNS name and the value of server would be equal to id of server you set in settings.xml
  4. Now execute mvn tomcat:redeploy to deploy your code to tomcat


Cristian Placintar said...

I knew it must be possible.
Works flawlessly. Thank you!

wapppictures said...

Wow! Totally what I needed.