MuleSoft provides Maven plugins that can automate the process of creating a new build that is triggered on every project change on different run-time environments.
There are various ways to Install Mule Runtime –
- Standalone Server
- Server Group
This article will detail a step-by-step guide on how to configure a Jenkins and Mule Maven project for continuous integration and delivery. The article also will attempt to demonstrate two deployment process scenarios, one to a standalone Mule runtime server and another on CloudHub.
- Jenkins 2.190.2
- Mule Runtime 3.9.3
- Maven 3.6.2
- Java 1.8
- Git 2.23.0
- Bitbucket for code repository
- Source tree to commit the code
Important Note: In order to connect and fetch resources from the Enterprise Maven Repository, you should contact the mule support center to receive your Enterprise Maven credentials and that will need to be entered into your settings.xml file (usually present within the $USER_HOME/.m2/ directory on your machine).
1. Configure maven:
- Download maven and set the environment variable
2. Configure settings.xml:
- Go to your $USER_HOME/.m2/ directory.
- Open settings XML adds the following section within the <servers> tag and replace YOUR_ID and YOUR_PASSWORD with the credentials provided to you by MuleSoft Support.
- Add the following section within the <profiles> tag to point to the location of the Enterprise Repository, referencing the same name above “Any Name”:
3. Download Git and set the environment variable
4. Install and Configure Jenkins:
- Download and Install the Jenkins
- Login into Jenkins
- Create Jenkins credentials
- Installed maven, git and pipeline plugin
- Go to Global Tool configuration and add the maven, JDK and git path
- Create a Jenkins Item with necessary details:
5. Create Mule-Maven Application
- Add the below plugin into pom.xml file
- In the property file, add the anypoint username, password and environment.
Mule Standalone Server:
6. Commit Code: Make some changes in the code and commit the code into Bitbucket repository through SourceTree. The Jenkins job will start automatically, and the mule application will be deployed/redeployed in the Cloudhub and Standalone Mule runtime.
7. Check the Jenkins Deployment Result
8. Application Testing: Test the application through postman.
The advantages of automated deployment to different environments triggered by changes are immense:
- Increase the chances of Go-to-market faster
- Release more often
- Configure it once
- Developers can develop
- Anyone can deploy
- Chances of error are reduced
- Immediate feedback
For any feedback or comments please send us an email at email@example.com