
A while ago I discussed how to go about automating your mobile builds using the Antenna extensions to Ant. One item that I did not touch on was how to deploy your application once it is ready. In today’s post I will cover how to deploy your application to the actual mobile device. To follow along with this post you will have to have read the previous article to ensure your builds are set-up and you have the required properties file ready.
Deploying With The Antenna OTA Servlet
Let’s first look at deploying your application using Antenna’s task and related over the air servlet. To follow along with this part of the deployment process you will need to have a servlet container such as Tomcat installed. You will also need to download the source distribution of Antenna. To get your instance of the Antenna OTA servlet set-up on Tomcat you can follow the simple instruction on the Antenna website.
Once you installed the OTA servlet and started up Tomcat you should be able to access the application by pointing your browser to http://localhost:8080/antenna. If everything went according to plan you should be presented with the following view:

Initial view of Antenna
With our servlet running and eagerly awaiting deployments, we can start writing our task to deploy our application.
<!-- Deploy to server -->
<target name="deploy">
<wtkdeploy jadfile="${jadfile.final}" jarfile="${jarfile}" target="${deploy.target}" delete="${do.delete.on.deploy}" />
</target>
This task is pretty straight forward and only requires us to set a couple of simple attributes. We need to specify our jadfile location, the jarfile location, the target to which we want to deploy these files, in our ase the above local URL and lastly set the delete flag. Setting delete to true will delete the current JAD and JAR files that are currently on the server. So when deploying you should set the delete flag to false.
There are some additional attributes you can set depending on the security enabled on the OTA servlet. If you did set-up authentication, you can pass the username and password to this task as follows:
<!-- Deploy to server with authentication -->
<target name="deploy" depends="initialize">
<wtkdeploy jadfile="${jadfile}" jarfile="${jarfile}" login="${username}" password="${password}" target="${deploy.target}" delete="${do.delete.on.deploy}" />
</target>
If you read my previous article you will have seen that we use a properties file to define the properties we are referring to in this task. If you do not already have a properties file, go ahead and create the file and add the following to it:
build.root=build
build.root.deploy.dir=${build.root}/deploy
jadfile=${build.root.deploy.dir}/DCT_Client.jad
jarfile=${build.root.deploy.dir}/DCT_Client.jar
username=user
password=pass
deploy.target=http://localhost:8080/antenna
do.delete.on.deploy=false
With all of the above set, please note that this task needs to have the dependency on initialize set if run independently from the rest of the build, we are ready to execute the task. You should see the following output to the console when you execute this task.

Task output
Once completed, you can refresh the Antenna page and you will see an entry of your newly deployed and ready to install mobile application.

Application deployed to Antenna
December 16, 2009
crucial post , really good perspective on the subject and very well written, this certainly has put a spin on my day, umpteen thanks from the USA and sustain up the good work
January 19, 2010
gday there, simply wished to say thanks alot for this article, it let me discover one thing I hadn’t given much reflection to it before.
February 4, 2010
That was intriguing . I like your quality that you put into your writing . Please do continue with more like this.