DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • How to Publish Artifacts to Maven Central
  • Releasing MuleSoft API
  • Fast Deployments of Microservices Using Ansible and Kubernetes
  • Deploy MuleSoft App to CloudHub2 Using GitHub Actions CI/CD Pipeline

Trending

  • Building IoT Time-Series Applications With Java and Apache IoTDB
  • A Software Factory on Kubernetes: Gemini Builds, jev Decides (Genkit + senro in Go)
  • How to Format Articles for DZone
  • Decoupling a Data Pipeline From the Tables It Was Never Supposed to Depend On

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Mulesoft 4: Continuous Delivery/Deployment With Maven

Mulesoft 4: Continuous Delivery/Deployment With Maven

The main aim of this article is to provide a standard mechanism to release project artifacts and deploy to Anypoint Platform.

By 
Ashok S [ASoyanke]
·
Updated Oct. 27, 20 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
30.1K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

The main aim of this article is to provide a standard mechanism to release project artifacts and deploy to Anypoint Platform, from the local machine or configure in continuous delivery pipelines.

Normally multiple people involved in the deployment process, one team/team member may handle check-in of code, others may handle configuration, and so on. very likely that any step may be missed out due to manual efforts.

For example:

  • Untested code gets to build and deploy.
  • Uncommitted code gets to build and deploy.
  • The deployment team deployed the older build again.
  • Running local build fails on the server.
  • Configuration, not sync’s.

Prerequisites

Minimum Anypoint Platform Role

CloudHub Developer / Developer

Exchange Contributors

Anypoint Platform Credentials

To deploy mule applications using a mule maven plugin, need to set the Anypoint platform credentials, please update Anypoint platform credentials information in the .m2/settings.xml as the following:

XML
 




x
13
9


 
1
<servers>
2
        <server>
3
              <id>MuleExchangeRepository</id>
4
              <username>anypoint_platfrom_id</username>
5
              <password>anypoint_platfrom_password</password>
6
        </server>
7
</servers>



Update GroupId in POM.XML

To set of identifiers to update groupId with an Organization ID. 

XML
 




xxxxxxxxxx
1


 
1
<groupId>[Organization ID]</groupId> 



Update SCM (Source Code/Control Management) Details in POM.XML

To release prepare mule applications using a mule maven plugin, we need to update SCM details.

XML
 




xxxxxxxxxx
1


 
1
<scm>
2
    <connection>scm:git:https://github.com/repo/${project.artifactId}.git</connection>
3
    <url>https://github.com/repo/${project.artifactId}</url>
4
    <developerConnection>scm:git:https://github.com/repo/${project.artifactId}.git</developerConnection>
5
    <tag>HEAD</tag>
6
</scm>



Update Distribution Management

To release perform and upload deployable mule applications using a mule maven plugin, need to update Distribution Management details.

XML
 




xxxxxxxxxx
1


 
1
<distributionManagement>
2
    <repository>
3
        <id>MuleExchangeRepository</id>
4
        <name>Mule Exchange Repository</name>
5
        <url>https://maven.anypoint.mulesoft.com/api/v1/organizations/${project.groupId}/maven</url>
6
        <layout>default</layout>
7
    </repository>
8
</distributionManagement>
9
 
          



For CloudHub Deployment

Update pom.xml with cloudHub Deployment configuration.

XML
 




xxxxxxxxxx
1
28


 
1
<build>
2
    <plugins>
3
        <plugin>
4
            <groupId>org.mule.tools.maven</groupId>
5
            <artifactId>mule-maven-plugin</artifactId>
6
            <version>${mule.maven.plugin.version}</version>
7
            <extensions>true</extensions>
8
            <configuration>
9
                <classifier>mule-application</classifier>                
10
                <cloudHubDeployment>
11
                    <uri>https://anypoint.mulesoft.com</uri>
12
                    <muleVersion>${muleVersion}</muleVersion>
13
                    <applicationName>${project.artifactId}</applicationName>
14
                    <environment>${cloud.env}</environment>
15
                    <businessGroup>${anypoint.businessGroup}</businessGroup>
16
                    <region>${region}</region>
17
                    <workers>${workers}</workers>
18
                    <workerType>${workerType}</workerType>
19
                    <server>${server}</server>
20
                    <properties>
21
                        <env>${app.env}</env>
22
                    </properties>
23
                </cloudHubDeployment>
24
            </configuration>
25
        </plugin>
26
    </plugins>
27
</build>



For Runtime Fabric Deployment

Update pom.xml with Runtime Fabric Deployment configuration.

XML
 




x
1
34


 
1
<build>
2
    <plugins>
3
        <plugin>
4
            <groupId>org.mule.tools.maven</groupId>
5
            <artifactId>mule-maven-plugin</artifactId>
6
            <version>${mule.maven.plugin.version}</version>
7
            <extensions>true</extensions>
8
            <configuration>
9
            <classifier>mule-application</classifier>                
10
                <runtimeFabricDeployment>
11
                    <uri>https://anypoint.mulesoft.com</uri>
12
                    <muleVersion>4.2.2</muleVersion>
13
                    <provider>MC</provider>
14
                    <businessGroup>${anypoint.businessGroup}</businessGroup>
15
                    <environment>${cloud.env}</environment>
16
                    <target>${target}</target>
17
                    <applicationName>${project.artifactId}</applicationName>
18
                    <server>${server}</server>
19
                    <deploymentSettings>
20
                        <replicationFactor>${replicationFactor}</replicationFactor>
21
                        <cpuReserved>${cpuReserved}</cpuReserved>
22
                        <cpuMax>${cpuMax}</cpuMax>
23
                        <memoryReserved>${memoryReserved}</memoryReserved>
24
                        <publicUrl>${project.artifactId}.${loadbalancer}</publicUrl>
25
                    </deploymentSettings>
26
                    <properties>
27
                        <env>${app.env}</env>
28
                    </properties>
29
                </runtimeFabricDeployment>  
30
            </configuration>
31
        </plugin>
32
    </plugins>
33
</build>
34



For Standalone Runtime Deployment

Update pom.xml with Standalone Runtime Deployment configuration.

XML
 




xxxxxxxxxx
1
15


 
1
<build>
2
    <plugins>
3
        <plugin>
4
            <groupId>org.mule.tools.maven</groupId>
5
            <artifactId>mule-maven-plugin</artifactId>
6
            <version>${mule.maven.plugin.version}</version>
7
            <extensions>true</extensions>
8
            <configuration>
9
                <standaloneDeployment>
10
                    <muleHome>${mule.home}</muleHome> 
11
                </standaloneDeployment>
12
            </configuration>
13
        </plugin>
14
    </plugins>
15
</build>



Release

Release:Prepare

After configuring all the prerequisites, make sure you are pointing at the branch you want to release. all your code is committed and pushed and pulled the latest version from origin

 run: mvn release:prepare 

The release:prepare goal will:

  • Verify that there are no uncommitted changes in the workspace.
  • Verify that there are no SNAPSHOT dependencies
  • Prompt the user for the desired tag, release, and development version names.
  • Modify and commit release information into the pom.xml file.
  • Tag the entire project source tree with the new tag name.
  • Move forward the version in the POMs to next SNAPSHOT version
  • Commit the modified POMs.

Release:Perform

Checks out the code using the previously defined tag and run the Maven deploy goal, upload deployable or artifact to Anypoint Exchange repository.

 mvn -B release:perform 

Deployment

Please check out the release tag for deployment:

git checkout --no-track -b deploytag <deployment-tag> --  

To CloudHub

 mvn deploy -DmuleDeploy -DmuleVersion=?
-Dcloud.env=?
-Danypoint.businessGroup=?
-Dregion=?
-Dworkers=?
-DworkerType=?
-Dserver=?
-Dapp.env=?
 

To Runtime Fabric

 mvn deploy -DmuleDeploy -Danypoint.businessGroup=?
-Dcloud.env=?
-Dtarget=?
-Dproject.artifactId=?
-Dserver=?
-DreplicationFactor=?
-DcpuReserved=?
-DcpuMax=?
-DmemoryReserved=?
-Dproject.artifactId=?
-Dloadbalance=?
-Dapp.env=?
 

To Standalone

mvn deploy -DmuleDeploy -Dmule.home=?

Please refer to Mulesoft Documentation for Additional information.

Thanks!

Apache Maven MuleSoft Continuous Integration/Deployment Release (computing)

Opinions expressed by DZone contributors are their own.

Related

  • How to Publish Artifacts to Maven Central
  • Releasing MuleSoft API
  • Fast Deployments of Microservices Using Ansible and Kubernetes
  • Deploy MuleSoft App to CloudHub2 Using GitHub Actions CI/CD Pipeline

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook