+

Search Tips   |   Advanced Search

Deploy applications and adapters

We can use Ant tasks to deploy MobileFirst applications and adapters.

The following sections show examples of Ant XML files that use the wladm Ant task to deploy applications and adapters. We can run these Ant files locally on the MobileFirst Server host computer or remotely on a different computer. To run them remotely on a different computer, we must first copy the file MF_HOME/WorklightServer/worklight-ant-deployer.jar to that computer.


Deploy an application

Before we use this Ant task, as a prerequisite step, deploy the corresponding MobileFirst project of the application. See Deploy the project WAR file.

A typical Ant script for deploying an application has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="target-name">
  <taskdef resource="com/worklight/ant/deployers/antlib.xml">
    <classpath>
      <pathelement location="MF_HOME/WorklightServer/worklight-ant-deployer.jar"/>
    </classpath>
  </taskdef>
  <target name="target-name">
    <wladm url="https://server-address:secure-port/worklightadmin" user="username" password="password">
      <deploy-app runtime="project-name" file="myApp.wlapp"/>
    </wladm>
  </target>
</project>

The <wladm> element has the following attributes:

Attribute Mandatory/Optional Description
url Mandatory The full URL of the MobileFirst Server web application for administration services
user and password Mandatory The credentials of a user in a worklightadmin or worklightdeployer role

The <deploy-app> element has the following attributes:

Attribute Mandatory/Optional Description
runtime Mandatory The name of the MobileFirst runtime / project.
file Mandatory Contains the .wlapp file to deploy.

For more information about <wladm>, see wladm Ant task.

If deploy more than one .wlapp file, either add a <deploy-app> element for each file in a single <wladm> element, or add a <wladm> element for each file.


Deploy an adapter

Before we use this Ant task, as a prerequisite step, deploy the corresponding MobileFirst project of the adapter. See Deploy the project WAR file.

A typical Ant script for deploying an adapter has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="target-name">
  <taskdef resource="com/worklight/ant/deployers/antlib.xml">
    <classpath>
      <pathelement location="MF_HOME/WorklightServer/worklight-ant-deployer.jar"/>
    </classpath>
  </taskdef>
  <target name="target-name">
    <wladm url="https://server-address:secure-port/worklightadmin" user="username" password="password">
      <deploy-adapter runtime="project-name" file="myAdapter.adapter"/>
    </wladm>
  </target>
</project>

The <wladm> element has the following attributes:

Attribute Mandatory/Optional Description
url Mandatory The full URL of the MobileFirst Server web application for administration services
user and password Mandatory The credentials of a user in a worklightadmin or worklightdeployer role

The <deploy-adapter> element has the following attributes:

Attribute Mandatory/Optional Description
runtime Mandatory The name of the MobileFirst runtime / project.
file Mandatory Contains the .adapter file to deploy.

For more information about <wladm>, see wladm Ant task.

If deploy more than one .adapter file, either add a <deploy-adapter> element for each file in a single <wladm> element, or add a <wladm> element for each file.


Parent topic: Ant tasks for building and deploying applications and adapters