Deploying applications and adapters
You 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. You 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, you must first copy the file product_install_dir/WorklightServer/worklight-ant-deployer.jar to that computer.
Deploying an application
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="product_install_dir/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>
Attribute | Mandatory/Optional | Description |
---|---|---|
url | Mandatory | The full URL of your MobileFirst Server web application for administration services |
user and password | Mandatory | The credentials of a user in a worklightadmin or worklightdeployer role |
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 Administering MobileFirst applications through Ant.
If you must 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.
Deploying an adapter
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="product_install_dir/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>
Attribute | Mandatory/Optional | Description |
---|---|---|
url | Mandatory | The full URL of your MobileFirst Server web application for administration services |
user and password | Mandatory | The credentials of a user in a worklightadmin or worklightdeployer role |
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 Administering MobileFirst applications through Ant.
If you must 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.