+

Search Tips | Advanced Search

For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Ant task for uploading or deleting an application

We can use the upload and delete tools as an Ant task and use the Ant task in your own Ant script.

Apache Ant is required to run these tasks. The minimum supported version of Apache Ant is listed in System requirements.

For convenience, Apache Ant 1.8.4 is included in IBM MobileFirstâ„¢ Platform Server. In the product_install_dir/shortcuts/ directory, the following scripts are provided:

These scripts are ready to run, which means that they do not require specific environment variables. If the environment variable JAVA_HOME is set, the scripts accept it.

When we use the upload tool as an Ant task, the classname value of the upload Ant task is com.ibm.appcenter.ant.UploadApps. The classname value of the delete Ant task is com.ibm.appcenter.ant.DeleteApps.

Parameters of Ant task Description
serverPath To connect to the Application Center. The default value is http://localhost:9080.
context The context of the Application Center. The default value is /applicationcenter.
loginUser The user name with permissions to upload an application.
loginPass The password of the user with permissions to upload an application.
forceOverwrite If this parameter is set to true, the Ant task attempts to overwrite applications in the Application Center when it uploads an application that is already present. This parameter is available only in the upload Ant task.
file The .apk or .ipa file to be uploaded to the Application Center or to be deleted from the Application Center. This parameter has no default value.
fileset To upload or delete multiple files.
application The package name of the application; this parameter is available only in the delete Ant task.
os The operating system of the application. (For example, Android or iOS.) This parameter is available only in the delete Ant task.
version The internal version of the application; this parameter is available only in the delete Ant task. Do not use the commercial version here, because the commercial version is unsuitable to identify the version exactly.


Example

We can find an extended example in the ApplicationCenter/tools/build.xml directory.

The following example shows how to use the Ant task in your own Ant script.

This sample Ant script is in the tools directory. We can use it to upload a single application to the Application Center.

We can also use it to upload all applications that are found in a directory hierarchy.


Properties of the sample Ant script

Property Comment
install.dir Defaults to ../../
server.path The default value is http://localhost:9080.
context.path The default value is applicationcenter.
upload.file This property has no default value. It must include the exact file path.
workspace.root Defaults to ../../
login.user The default value is appcenteradmin.
login.pass The default value is admin.
force The default value is true.

To specify these parameters by command line when you call Ant, add -D before the property name. For example:

Parent topic: Command-line tool for uploading or deleting an application