Thursday, April 15, 2010

Deploying war to Tomcat using Maven

Step1: Add following in tag:

Step2: Add the username and password for the manager account in $MAVEN_HOME/conf/settings.xml file.
value in tag in step1 should be same as id in in step2

Step3: Maven command to build & deploy
        mvn clean install tomcat:deploy

to undeploy use: 
     mvn tomcat:undeploy

This does:

  • Deletes the service-war/target output folder if it already exists (same as mvn clean alone)
  • Recreates the folder and generates and compiles the Java classes into it (mvn package)
  • Creates a WAR file for the web service provider and JAR file for the JAX-WS artifacts (mvn package)
  • Installs the JAR and WAR into your local Maven repository (mvn install)
  • Undeploys the previous WAR file (tomcat:undeploy of the Maven Tomcat plugin) from Tomcat
  • Deploys the new WAR file onto Tomcat. (mvn tomcat:deploy)

No comments:

Post a Comment