MuleSoft provides Maven plugins that can automate the creation of a new build triggered on every project change on different run-time environments.
There are various ways to install Mule Runtime:
- Standalone Server
- Cluster
- CloudHub
- Server Group
This article will outline a detailed step-by-step guide on configuring a Jenkins and Mule Maven project for continuous integration and delivery. We will also demonstrate two deployment process scenarios, one for a standalone Mule runtime server and another on CloudHub.
Installation Prerequisites
- 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
- Postman
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).
Procedure:
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”:
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 the necessary details
- Add the below plugin to the pom.xml file
- In the property file, add the Anypoint username, password, and environment.
CloudHub
7. Check the Jenkins Deployment Result
Conclusion
There are many advantages of automated deployment to different environments triggered by changes:
- 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