How to Perform a Remote Deploy

by Michela Frigerio
9,465 views Published on Oct 24, 2011
Applies to: All versions
Table of contents

WebRatio allows you to execute automatically all the operation necessary in order to deploy a Web Application using a Deployment Plan. Please refer to this article for an introduction to the feature. As explained in the referred article, it's possible to include a task which invoke an Ant script. This particular type of script allows you to include every operation that you want in your deployment process. For more information about Ant see

In order to deploy a Web Application on a Linux/Unix server on which a Tomcat Application Server is running, you just have to copy the WAR file containing the Web Application. The deployment plan will be composed by the following tasks:

  1. Clear Deployment Folder.
  2. Generate Full Web Project.
  3. WAR.
  4. Ant.

The steps 1 and 2 generate the Web Application moving the folder in a special deploy directory which is different from the standard Tomcat webapps.The step 3 creates a WAR file including all the Web Application. The last step copies the WAR file in the webapps directory of a remote server, and this logic is written using Ant. Here is an example of the Ant Script you can use to do the remote deploy:

        <project default="main">

                <target name="main" depends="loadProperties">

                        <fail unless="project_name" message="Must be executed from a Deployment Plan"/>

                        <echo message="Remote Deploy"/>

                        <scp file="${deploy_loc}/../MyWebApplication.war"






                <target name="loadProperties">

                        <property name="" value=""/>

                        <property name="deploy.port" value="22"/>

                        <property name="deploy.username" value="user"/>

                        <property name="deploy.password" value="password"/>

                        <property name="deploy.path" value="/home/tomcat/webapps"/>



The solution provided uses the SSH protocol to upload the WAR File. The name of the WAR file must be the same of the one used in the Deployment Plan. The "loadProperties" <target> element of the Ant Script set the properties for the connection to the server. It's also possible to use an external file including the connection properties and use it in the Ant Script using the <property file=""/> task. In this case, it's better to place the properties file in a folder ouside the Web Project so that the password remains private. It's also possible to start the Tomcat Application Server if it is not running, using the <sshexec> task.

N.B. Some special Ant task, such as <scp> or <sshexec> depends on JAR file which are not included in the WebRatio installation and must be manually configured. For this example you can download the libraries here. Once downloaded the files, open the Preferences window and add those JAR in the section Ant > Runtime > Global Entries. For detailed information abount Ant tasks, their syntax please read this link.