---
schema_version: "1"
id: c5931f9aaede8c0b339a1924885640f7f0b686aff3b993a9175b1121cd70a63f
title: Deploy Applications to CloudHub Using the Mule Maven Plugin
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/4.11/deploy-to-cloudhub.md
canonical_url: https://docs.mulesoft.com/mule-runtime/4.11/deploy-to-cloudhub
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 18540c74fd5d526800608948cdde0347bf87a9570f60ce6d852d295d5d197ab7
description: MuleSoft Documentation Site
release: "4.11"
latest: false
---
---
product: Mule Runtime
version: 4.11
---

# Deploy Applications to CloudHub Using the Mule Maven Plugin

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

> [!WARNING] Mule Maven plugin versions 3.0.0, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6,
> 3.1.7, and 3.8.3 are deprecated.

> [!NOTE] Where possible, we changed noninclusive terms to align with our company value of Equality.
> We maintained certain terms to avoid any effect on customer implementations.

In addition to using Anypoint Studio, Anypoint Runtime Manager, or the Anypoint Platform CLI to
deploy applications to CloudHub, you can also deploy, redeploy, or undeploy applications by using
the Mule Maven plugin. To do so, you must meet certain prerequisites, and configure your CloudHub
deployment strategy in your project’s `pom.xml` file.

If you want to deploy applications to CloudHub using a different method, see:

- [Deploy Applications to CloudHub Using Anypoint Studio](https://docs.mulesoft.com/studio/deploy-mule-application-task)

- [Deploy Applications to CloudHub Using the Anypoint CLI](https://docs.mulesoft.com/anypoint-cli/latest/cloudhub-apps#deploy-to-cloudhub)

- [Deploy Applications to CloudHub Using Runtime Manager](https://docs.mulesoft.com/cloudhub/deploying-to-cloudhub)

## Prerequisites

Before you can deploy to CloudHub using the Mule Maven plugin, you must complete the following
tasks:

- Add the Mule Maven plugin to your project

  See [Add the Mule Maven Plugin to a Mule Project](https://docs.mulesoft.com/mule-runtime/4.11/mmp-concept#add-mmp) for instructions.

- If you are using the HTTP Listener as source for your flow, you need to set its host to
  **0.0.0.0** and its port to **${http.port}**

- Declare all external classes and resources in the `exportedPackages` and `exportedResources`
  fields on the `mule-artifact.json` file

## Configure the CloudHub Deployment Strategy

Configure the CloudHub deployment strategy in your project’s `pom.xml` file so you can deploy,
redeploy and undeploy your Mule application using the Mule Maven plugin.

Inside the `plugin` element in your project’s `pom.xml` file, configure your CloudHub deployment,
replacing the placeholder values with your CloudHub information:

```xml
<plugin>
  <groupId>org.mule.tools.maven</groupId>
  <artifactId>mule-maven-plugin</artifactId>
  <version>3.7.1</version>
  <extensions>true</extensions>
  <configuration>
    <cloudHubDeployment>
      <uri>https://anypoint.mulesoft.com</uri>
      <muleVersion>${app.runtime}</muleVersion>
      <username>${username}</username>
      <password>${password}</password>
      <applicationName>${cloudhub.application.name}</applicationName>
      <environment>${environment}</environment>
      <region>${region}</region>
      <workers>${workers}</workers>
      <workerType>${workerType}</workerType>
      <properties>
        <key>value</key>
      </properties>
    </cloudHubDeployment>
  </configuration>
</plugin>
```

## Deploy to CloudHub

From the command line in your project’s folder, package the app and execute the deploy goal:

```console
mvn clean deploy -DmuleDeploy
```

## Redeploy to CloudHub

To redeploy a Mule application using Mule Maven plugin, run `mvn clean deploy -DmuleDeploy` as you
did to previously deploy the app. CloudHub rewrites the app you had deployed.

## Undeploy from CloudHub

To undeploy a Mule application using Mule Maven plugin, run the following command:

```console
mvn mule:undeploy
```

The undeploy command also deletes the app in Mule Maven plugin 3.3.0 and later versions.

## Authentication Methods

When you deploy applications using Mule Maven plugin, you can use different methods to provide your
credentials to authenticate against the deployment platform. Depending on the authentication method
you use, the parameters to set in the deployment configuration differ:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Authentication Method</th><th>Description</th><th>Configuration Parameters</th></tr></thead><tbody><tr><td><div><div><p>Username and password</p></div></div></td><td><div><div><p>Use a CloudHub username and password to authenticate.</p></div></div></td><td><div><div><ul><li><p><code>username</code><br></p></li><li><p><code>password</code></p></li></ul></div></div></td></tr><tr><td><div><div><p>Server</p></div></div></td><td><div><div><p>Use credentials stored in a Maven server, configured inside the Maven <code>settings.xml</code> file.</p></div></div></td><td><div><div><ul><li><p><code>server</code></p></li></ul></div></div></td></tr><tr><td><div><div><p>Authorization Token</p></div></div></td><td><div><div><p>Use an authorization token to access the platform.<br>See <a href="https://docs.mulesoft.com/access-management/external-identity">Identity Management</a> for a list of supported single sign-on (SSO) types.</p></div></div></td><td><div><div><ul><li><p><code>authToken</code></p></li></ul></div></div></td></tr><tr><td><div><div><p>Connected Apps</p></div></div></td><td><div><div><p>Use a Connected App to perform the authentication programmatically by communicating with Anypoint Platform.<br>Note that the Connected App credentials must have the <code>Design Center Developer</code> access scope.<br>See <a href="https://docs.mulesoft.com/access-management/connected-apps-developers">Connected Apps for Developers</a> for instructions about creating Connected Apps.</p></div></div></td><td><div><div><ul><li><p><code>connectedAppClientId</code><br></p></li><li><p><code>connectedAppClientSecret</code><br></p></li><li><p><code>connectedAppGrantType</code></p></li></ul></div></div></td></tr></tbody></table>

For a detailed description of the configuration parameters, see the
[CloudHub Deployment Reference](#cloudhub-deploy-reference).

## CloudHub Deployment Reference

The following table shows the available parameters to configure the CloudHub deployment strategy in
your project’s `pom.xml` file.

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td><div><div><p><code>cloudHubDeployment</code></p></div></div></td><td><div><div><p>Top-level element</p></div></div></td><td><div><div><p>Yes</p></div></div></td></tr><tr><td><div><div><p><code>uri</code></p></div></div></td><td><div><div><p>Your Anypoint Platform URI<br>If not set, by default this value is set to https://anypoint.mulesoft.com.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>muleVersion</code></p></div></div></td><td><div><div><p>The Mule runtime engine version to run in your CloudHub instance.<br>Ensure that this value is equal to or higher than the earliest required Mule version of your application.<br>Example value: <code>4.3.0</code><br>Starting with Mule 4.5, deployments to CloudHub accept the Mule version exact name or the semantic versioning, which deploys the latest version of Mule runtime.<br>Example values: <code>4.6</code>, <code>4.6-e-java8</code> (Edge), <code>4.6-e-java17</code> (Edge), <code>4.6-java8</code> (LTS), <code>4.6-java17</code> (LTS)<br>When using Mule Maven plugin versions 3.8.0 and 4.0.0 for deployments, MuleSoft doesn’t guarantee support for LTS channel. We recommend that you use Mule Maven plugin version 4.1.1 or later. For example, specifying <code>&lt;muleVersion&gt;4.6-java17&lt;/muleVersion&gt;</code> in the plugin 3.8.0 or 4.0.0 deploys the application with an Edge release channel and a Java 8 selection. To specify <code>releaseChannel</code> and <code>javaVersion</code>, upgrade the plugin to version 4.1.1 or later.</p></div></div></td><td><div><div><p>Yes</p></div></div></td></tr><tr><td><div><div><p><code>releaseChannel</code></p></div></div></td><td><div><div><p>Set the name of the release channel to use for the selected Mule version. Supported values are <code>NONE</code>, <code>EDGE</code>, and <code>LTS</code>. If you don’t specify a Mule version, the default Mule version for the selected release channel is used. If the selected release channel doesn’t exist, an error occurs.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>javaVersion</code></p></div></div></td><td><div><div><p>Set the name of the Java version to use for the selected Mule version. Supported values are <code>8</code> and <code>17</code>. If you don’t specify a Mule version, the default Mule version for the selected Java version is used. If the Java version you select isn’t available for the specified Mule version, an error occurs.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>username</code></p></div></div></td><td><div><div><p>Your CloudHub username</p></div></div></td><td><div><div><p>Only when using Anypoint Platform credentials to login.</p></div></div></td></tr><tr><td><div><div><p><code>password</code></p></div></div></td><td><div><div><p>Your CloudHub password</p></div></div></td><td><div><div><p>Only when using Anypoint Platform credentials to login.</p></div></div></td></tr><tr><td><div><div><p><code>applicationName</code></p></div></div></td><td><div><div><p>The name of your application in CloudHub<br>This name is part of the domain of your deployed app. For example, naming your application application-1 makes your app’s public domain application-1.cloudhub.io.</p></div></div></td><td><div><div><p>Yes</p></div></div></td></tr><tr><td><div><div><p><code>artifact</code></p></div></div></td><td><div><div><p>The absolute path of the JAR file to be deployed<br>If not set, the path defaults to the location of the JAR file generated at the package phase.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>environment</code></p></div></div></td><td><div><div><p>The CloudHub environment to which you want to deploy<br>This value must match any environment configured in your CloudHub account.<br></p></div><div><div><pre><code data-lang="xml">&lt;environment&gt;Sandbox&lt;/environment&gt;</code></pre></div></div></div></td><td><div><div><p>Yes</p></div></div></td></tr><tr><td><div><div><p><code>properties</code></p></div></div></td><td><div><div><p>Top-Level element<br>If you need to set properties for the Mule application you are deploying, you can use the <code>&lt;properties&gt;</code> top-level element:</p></div><div><div><pre><code data-lang="xml">&lt;properties&gt;
  &lt;key&gt;value&lt;/key&gt;
&lt;/properties&gt;</code></pre></div></div><div><p>For example:</p></div><div><div><pre><code data-lang="xml">&lt;properties&gt;
  &lt;http.port&gt;8081&lt;/http.port&gt;
&lt;/properties&gt;</code></pre></div></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>propertiesFile</code></p></div></div></td><td><div><div><p>Top-level element<br>Specifies a file that contains properties for the Mule application being deployed. Use this parameter as an alternative to defining properties inline with <code>&lt;properties&gt;</code>. The file must use the Java properties format, with one <code>key=value</code> pair per line.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>workers</code></p></div></div></td><td><div><div><p>The number of workers<br>By default, this value is 1.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>workerType</code></p></div></div></td><td><div><div><p>Size of each worker; one of the following values:</p></div><div><ul><li><p><code>MICRO</code> (default; 0.1 vCores)</p></li><li><p><code>SMALL</code> (0.2 vCores)</p></li><li><p><code>MEDIUM</code> (1 vCore )</p></li><li><p><code>LARGE</code> (2 vCores)</p></li><li><p><code>XLARGE</code> (4 vCores)</p></li><li><p><code>XXLARGE</code> (8 vCores)</p></li><li><p><code>4XLARGE</code> (16 vCores)</p></li></ul></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>region</code></p></div></div></td><td><div><div><p>Region of worker clouds; one of the following values:</p></div><div><ul><li><p><code>us-east-1</code> (default; US East, N. Virginia)</p></li><li><p><code>us-east-2</code> (US East, Ohio)</p></li><li><p><code>us-west-1</code> (US West, N. California)</p></li><li><p><code>us-west-2</code> (US West, Oregon)</p></li><li><p><code>us-gov-west-1</code> (MuleSoft Government Cloud)</p></li><li><p><code>eu-central-1</code> (EU, Frankfurt)</p></li><li><p><code>eu-west-1</code> (EU, Ireland)</p></li><li><p><code>eu-west-2</code> (UK, London)</p></li><li><p><code>ap-southeast-1</code> (Asia Pacific, Singapore)</p></li><li><p><code>ap-southeast-2</code> (Asia Pacific, Sydney)</p></li><li><p><code>ap-northeast-1</code> (Asia Pacific, Tokyo)</p></li><li><p><code>ca-central-1</code> (Canada, Central)</p></li><li><p><code>sa-east-1</code> (South America, São Paulo)</p></li></ul></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>objectStoreV2</code></p></div></div></td><td><div><div><p>Enables Object Store V2<br>By default, this value is set to <code>true</code> to match the Runtime Manager configuration of OSv2.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>persistentQueues</code></p></div></div></td><td><div><div><p>Enables persistent queues<br>By default, it is set to <code>false</code>.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>businessGroup</code></p></div></div></td><td><div><div><p>The Business group path of the deployment<br>Specify the full hierarchical path from the parent organization to the target Business group, for example:</p></div><div><div><pre><code data-lang="xml">&lt;businessGroup&gt;ParentOrg\SubOrg1\myBusinessGroup&lt;/businessGroup&gt;</code></pre></div></div><div><p>This value is omitted if <code>businessGroupId</code> is set. If <code>businessGroup</code> and <code>businessGroupId</code> are not set, the value defaults to the main business group of the user.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>businessGroupId</code></p></div></div></td><td><div><div><p>The Business group ID of the deployment<br>Instead of specifying the Business group path, you can specify the Business group ID to deploy your application. If <code>businessGroupId</code> and <code>businessGroup</code> are not set, the value defaults to the main business group of the user.<br>The Business group ID is a mandatory parameter when you have access only to a specific Business group but not to the parent organization.<br>This parameter is available in plugin version 3.2.7 and later.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>deploymentTimeout</code></p></div></div></td><td><div><div><p>The allowed elapsed time, in milliseconds, between the start of the deployment process and the confirmation that the artifact has been deployed</p></div><div><p>The default value is <code>600000</code>.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>server</code></p></div></div></td><td><div><div><p>Maven server with Anypoint Platform credentials<br>This is only needed if you want to use your credentials stored in your Maven <code>settings.xml</code> file. This is not the Mule server name.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>skip</code></p></div></div></td><td><div><div><p>When set to <code>true</code>, skips the plugin deployment goal.<br>Its default value is <code>false</code>.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>skipDeploymentVerification</code></p></div></div></td><td><div><div><p>When set to <code>true</code>, skips the status verification of your deployed app.<br>Its default value is <code>false</code>.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>authToken</code></p></div></div></td><td><div><div><p>Specifies the authorization token to access the platform. You can use this authentication method instead of setting username and password.<br>See <a href="https://docs.mulesoft.com/access-management/external-identity">Identity Management</a> for a list of supported single sign-on (SSO) types.</p></div></div></td><td><div><div><p>Only when using an Authorization token to login.</p></div></div></td></tr><tr><td><div><div><p><code>connectedAppClientId</code></p></div></div></td><td><div><div><p>Specifies the Connected App <code>clientID</code> value.</p></div></div></td><td><div><div><p>Only when using Connected Apps credentials to login.</p></div></div></td></tr><tr><td><div><div><p><code>connectedAppClientSecret</code></p></div></div></td><td><div><div><p>Specifies the Connected App secret key.</p></div></div></td><td><div><div><p>Only when using Connected Apps credentials to login.</p></div></div></td></tr><tr><td><div><div><p><code>connectedAppGrantType</code></p></div></div></td><td><div><div><p>Specifies the only supported connection type: <code>client_credentials</code>.</p></div></div></td><td><div><div><p>Only when using Connected Apps credentials to login.</p></div></div></td></tr><tr><td><div><div><p><code>applyLatestRuntimePatch</code></p></div></div></td><td><div><div><p>When set to <code>true</code>, the plugin instructs CloudHub to update the worker to the latest available patch for the Mule runtime engine version specified in the deployment configuration, and then deploys the application.<br>By default, it is set to <code>false</code>.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr><tr><td><div><div><p><code>disableCloudHubLogs</code></p></div></div></td><td><div><div><p>When set to <code>true</code>, the plugin instructs CloudHub to disable CloudHub logging and instead use the application configured in the <code>log4j2.xml</code> file.<br>By default, it is set to <code>false</code>.</p></div></div></td><td><div><div><p>No</p></div></div></td></tr></tbody></table>

## Encrypt Credentials

To use encrypted credentials when deploying, you need to set up your Maven master encrypted password
and your `settings-security.xml` file.

1.  Create a master password for your Maven configuration.

    mvn --encrypt-master-password <yourMasterPassword>

    Maven returns your master password encrypted:

    {l9vZ2uM5SdgHy+H12z4pX7LEOZn3Kbnqmt3kIquLjnQ=}

2.  Create a `settings-security.xml` file in your ~/.m2 repository and add your encrypted master
    password:

    ```xml
    <settingsSecurity>
      <master>{l9vZ2uM5SdgHy+H12z4pX7LEOZn3Kbnqmt3kIquLjnQ=}</master>
    </settingsSecurity>
    ```

3.  Encrypt your Anypoint platform password:

    mvn --encrypt-password <yourAnypointPlatformPassword>

    Maven returns your Anypoint platform password encrypted:

    {HTWFGH5BG9QmvJ1B=}

4.  Add your encrypted Anypoint Platform password to your `settings.xml` file in the <server>
    section:

    ```xml
    <settings>
     ...
      <servers>
       ...
        <server>
          <id>my.anypoint.credentials</id>
          <username>my.anypoint.username</username>
          <password>{HTWFGH5BG9QmvJ1B=}</password>
        </server>
       ...
      </servers>
     ...
    </settings>
    ```

5.  In your configuration deployment, reference the credentials injecting the server ID configured
    in your `settings.xml` file:

    ```xml
    <plugin>
      ...
      <configuration>
        ...
        <cloudHubDeployment>
          ...
          <server>my.anypoint.credentials</server>
          ...
        </cloudHubDeployment>
        ...
      </configuration>
      ...
    <plugin>
    ```

    > [!NOTE] Make sure that the username and password are not set in the deployment configuration,
    > or they will overwrite the defined server ID.

## See also

- [Mule Maven Plugin](https://docs.mulesoft.com/mule-runtime/4.11/mmp-concept)

- [Export Resources](https://docs.mulesoft.com/mule-runtime/4.11/how-to-export-resources)
