Using Travis CI for Deploying MuleSoft Applications to Cloudhub

Author: Kuldeep Rana

What is Travis CI ?

  • Travis CI is a hosted continuous integration service used to build and test software projects hosted at GitHub and Bitbucket. Travis CI provides various paid plans for private projects and a free plan for open source. 

To start using Travis CI, make sure you have:

To get started with Travis CI using GitHub 

  1. Go to and Sign up with GitHub.
  2. Accept the Authorization of Travis CI. You’ll be redirected to GitHub.
  3. Click on your profile picture in the top right of your Travis Dashboard, click Settings and then on the Left hand side, Sync Account button. This will sync all your repositories in the github with Travis CI.
  4. Add a .travis.yml file to the root of your repository to tell Travis CI what to do. Below is the example of a travis.yml file that I used to build the integration:
language: java
    - openjdk8
        -  "$HOME/.m2"
   - cp .travis.settings.xml $HOME/.m2/settings.xml

   - stage: Start
     name: "Application is ready"
          - echo "$applicationName is ready to be deployed"
   - stage: Test
     name: "Run Tests"
          - mvn clean package  
   - stage: Deploy #stage type
     name: "Deploy stage" #stage name
          - mvn deploy -DmuleDeploy -Danypoint.username=$username -Danypoint.password=$password -Danypoint.environment=$environment -Danypoint.workerType=$workerType -Danypoint.businessGroup=$businessGroup -Danypoint.workers=$workers -Danypoint.appName=$applicationName -Danypoint.objectStore=$objectStore

        on_success: always
        on_failure: always
  1. Add .travis.setting.xml to the root of your repository. This will have the URL to all the repositories from where all the dependencies will get downloaded to build the project. Below is the example of the file used in the integration:

Now, for deploying MuleSoft application to CloudHub, you need to configure Mule maven plugin in POM.xml.

Declaring Environment Variables at Travis CI

For declaring the variable, you can activate the repository and click on settings. It will navigate to the build screen. Now click on More Options ⇒ Settings. Scroll down and it will show you the Environment Variables tab to declare your variables.

For the above code, all environment variables have been declared — required by Mule maven plugin like workers, workerType, Application Name, etc. and username and password required by .travis.settings.xml

Once all the changes are pushed to the git and Travis CI is activated for that repository, the Continuous Integration and Continuous Deployment process will take place. You can check the logs for further details.

The application is successfully deployed to cloudhub.

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.