Deploying your Mule Application to CloudHub using Apache Ant



We wrote a blog over a year ago showing you how to use Ant to package and deploy your Mule Application to your Mule server. With this blog I’d like to show you how we have extended his work so that you can also deploy to CloudHub. Why would you want to do that from Ant? Why Continuous Integration of course! Wouldn’t it be nice for it go from development to to automatically just as you do in-house? Of course it would!

Java Code

So, in the typical Ant way of doing things, we have to write a Java class per Ant Task. We’ll call the class CloudHubDeploy. In the execute() method we exploit CloudHub’s REST API and post the zip archive to CloudHub. We use Jersey Client to communicate with the server.

We must remember to map the class in the file in src/main/resources:




Ant Script

So, to communicate with CloudHub we should provide a username and password, the domain for the Application and of course the Application zip file itself.

And now, making use of all the good work Mike put in, let’s modify his example script and replace the deployment bit!


The proof is in the pudding! After executing the Ant build script shown above, we can login to CloudHub’s console and watch our Mule Application, called holamundo, deploy:

After, just a couple of seconds you’ll see how it’s running on the !

You can get the souce code and the Task jar itself at the same location at

We'd love to hear your opinion on this post

One Response to “Deploying your Mule Application to CloudHub using Apache Ant”

  1. […] Deploying your Mule Application to CloudHub using Apache Ant […]