Loading

How to deploy and update projects in CloudHub 2.0 using Maven

Publiseringsdato: Jul 29, 2025
Oppgave

Deploying to CloudHub 2.0 requires that you upload the project to Exchange and then deploy to CloudHub. Refer to the sample pom.xml provided in this article.

To update your project using CloudHub 2.0, you need to increment the version number in your pom.xml, deploy the updated project to Exchange, and then redeploy to CloudHub 2.0.

Trinn

A. Deploy your project into Exchange

1. Create a project in Studio
2. Open the pom.xml
3. Click on the link below - follow the instructions from the top of the article to modify your pom.xml so it is ready to be deployed into Exchange (sample pom.xml is below):
https://docs.mulesoft.com/exchange/to-publish-assets-maven
4. In Studio, right-click on your project -> "Properties" -> "Resource" -> copy the URL where your project is located
5. Open a command prompt or terminal and cd into the location you copied
6. Run the below command to deploy your project into Exchange:

mvn clean deploy

7. If it is deployed successfully, the console will show the URL where it is located in Exchange

Example:

[INFO]   Your asset has been successfully published to Exchange.
[INFO]   You can check it at: https://anypoint.mulesoft.com/exchange/abc12345-678d-5t5t-7u86-abc123abc123/test123/1.0.0


B. Deploy to CloudHub 2.0

1. Open the project in Studio
2. Open the pom.xml
3. Click on the link below - follow the instructions from the top of the article to modify your pom.xml so it is ready to be deployed into CloudHub 2.0:
https://docs.mulesoft.com/mule-runtime/4.4/deploy-to-cloudhub-2

Tips:
For target, please enter a location listed from this document:
https://docs.mulesoft.com/cloudhub-2/ch2-architecture#regions-and-dns-records

Example:

<target>Cloudhub-US-East-2</target>


4. In Studio, right-click on your project -> "Properties" -> "Resource" -> copy the URL where your project is located
5. Open a command prompt or terminal and cd into the location you copied
6. Run the below command to deploy your project into CloudHub 2.0:

mvn clean deploy -DmuleDeploy

7. If it does not work, run the below command to get debug logs:

mvn clean deploy -DmuleDeploy -X

8. If it is deployed successfully, the console will return a response for you to validate

C. Update a project in CloudHub 2.0

1. In order to update your project in CloudHub 2.0, you need to change the version in your pom.xml and upload the project again to Exchange following the steps in section A. For example, if the version was 1.0.0 as in this example, you need to increment the version to 1.0.1 in your pom.xml. Versions should follow semantic versioning: https://semver.org

Example of incrementing the version in your pom.xml:

<groupId>abcd-abcd-abcd-abcd-abcdabcd</groupId>
  <artifactId>test123</artifactId>
  <version>1.0.1</version>
  <packaging>mule-application</packaging>


2. After updating the version in your pom.xml and saving the file, you can follow the same steps in section A to update the asset in Exchange
3. Validate the asset is successfully updated in Exchange by going to the URL returned in the console
4. After you have validated that it is updated, you can follow the same steps in section B to update the project in CloudHub 2.0


Sample pom.xml

Instructions:
- This is a sample pom.xml that was used to deploy a project to Exchange and CloudHub 2.0 in November 2023
- We have listed maven settings.xml file authentication in the article, replace with the one you are using.
- For <mule.maven.plugin.version> we recommend you use the latest version:
https://docs.mulesoft.com/release-notes/mule-maven-plugin/mule-maven-plugin-release-notes
- For <muleVersion>, we recommend using the latest runtime version:
https://docs.mulesoft.com/release-notes/mule-runtime/mule-esb
- If you are going to use this, copy/paste into a text file and edit it first
- All values need to be replaced/edited

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- Insert your Organization ID -->
    <groupId>p18at6o1-0484-4d95-carc-a9ni96a876cb</groupId>
    <artifactId>deploy2ch20withmmp</artifactId>
    <version>1.0.0</version>
    <packaging>mule-application</packaging>

    <name>deploy2ch20withmmp</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <app.runtime>4.4.0-20230918</app.runtime>
        <!-- updated November 16th 2023 -->
        <mule.maven.plugin.version>4.0.0</mule.maven.plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.2.0</version>
            </plugin>
            <!-- Modified to add CH 2.0 deployment settings -->
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule.maven.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <classifier>mule-application</classifier>
                    <cloudhub2Deployment>
                        <uri>https://anypoint.mulesoft.com</uri>
                        <provider>MC</provider>
                        <environment>Sandbox</environment>
                        <target>Cloudhub-US-West-2</target>
                        <muleVersion>4.4.0</muleVersion>
                        <!-- This is only needed if you want to use your credentials stored in your Maven settings.xml file. This is not the Mule server name. -->
                        <server>Repository</server>
                        <applicationName>${appName}</applicationName>
                        <replicas>1</replicas>
                        <vCores>0.1</vCores>
                    </cloudhub2Deployment>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-http-connector</artifactId>
            <version>1.7.3</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-sockets-connector</artifactId>
            <version>1.2.3</version>
            <classifier>mule-plugin</classifier>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>anypoint-exchange-v3</id>
            <name>Anypoint Exchange</name>
            <url>https://maven.anypoint.mulesoft.com/api/v3/maven</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>https://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
        
       <!-- Added for Exchange deployment -->
       <repository>
         <id>Repository</id>
         <name>Private Exchange repository</name>
         <url>https://maven.anypoint.mulesoft.com/api/v3/organizations/${project.groupId}/maven</url>
         <layout>default</layout>
       </repository>

    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <layout>default</layout>
            <url>https://repository.mulesoft.org/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <!-- Added for Exchange deployment -->
    <distributionManagement>
        <repository>
            <id>Repository</id>
            <name>Corporate Repository</name>
            <url>https://maven.anypoint.mulesoft.com/api/v3/organizations/${project.groupId}/maven</url>
            <layout>default</layout>
        </repository>
    </distributionManagement>

</project>
Knowledge-artikkelnummer

001116062

 
Laster
Salesforce Help | Article