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 CI to CloudHub automatically just as you do in-house? Of course it would!
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 mulePackagingTasks.properties file in src/main/resources:
MuleSoft provides the most widely used integration platform for connecting any application, data source or API, whether in the cloud or on-premises. With Anypoint Platform®, MuleSoft delivers a complete integration experience built on proven open source technology, eliminating the pain and cost of point-to-point integration. Anypoint Platform includes CloudHub™ iPaaS, Mule ESB™, and a unified solution for API management™, design and publishing.