News and Events

News and Events

Using Mule Maven Plugin v4.4.0 for Cloudhub 2.0 Deployments

The latest release of the Mule Maven Plugin (v4.4.0) introduces an important update for Cloudhub 2.0 deployments. One of the key changes is the relocation of the pathRewrite attribute, which now must be placed under <deploymentSettings><http><inbound>.

If this is not configured correctly, deployments will fail with the following error message:

Unable to parse configuration of mojo org.mule.tools.maven:mule-maven-plugin:4.4.0:clean for parameter pathRewrite: Cannot find 'pathRewrite' in class org.mule.tools.model.anypoint.Cloudhub2Deployment

🚀 What Changed?

Previously, pathRewrite could be configured at a higher level in the deployment settings. In v4.4.0, it must be explicitly defined under <http><inbound> inside <deploymentSettings>.

Correct Placement in v4.4.0:

<deploymentSettings>
   <http>
      <inbound>
         <pathRewrite>...</pathRewrite>
      </inbound>
   </http>
</deploymentSettings>

If your pathRewrite configuration is still at the old location, your deployment will fail.


✅ Updated Mule Maven Plugin Configuration

The following Mule Maven Plugin configuration is the correct way to deploy applications on Cloudhub 2.0 using Mule Maven Plugin v4.4.0:

<plugin>
    <groupId>org.mule.tools.maven</groupId>
    <artifactId>mule-maven-plugin</artifactId>
    <version>4.4.0</version>
    <extensions>true</extensions>
    <configuration>
        <skip>false</skip>
        <redeploy>true</redeploy>
        <cloudhub2Deployment>
            <uri>https://anypoint.mulesoft.com</uri>
            <applicationName>${cloudhub2.applicationName}</applicationName>
            <muleVersion>${cloudhub2.muleVersion}</muleVersion>
            <javaVersion>${jdk.version}</javaVersion>
            <provider>${cloudhub2.provider}</provider>
            <environment>${cloudhub2.environment}</environment>
            <businessGroupId>${cloudhub2.businessGroupId}</businessGroupId>
            <deploymentTimeout>${cloudhub2.deploymentTimeout}</deploymentTimeout>
            <target>${cloudhub2.target}</target>
            <releaseChannel>${cloudhub2.releaseChannel}</releaseChannel>
            <connectedAppClientId>${connectedApp.clientId}</connectedAppClientId>
            <connectedAppClientSecret>${connectedApp.clientSecret}</connectedAppClientSecret>
            <connectedAppGrantType>${connectedApp.grantType}</connectedAppGrantType>
            <replicas>${cloudhub2.replicas}</replicas>
            <vCores>${cloudhub2.vCores}</vCores>
            <deploymentSettings>
                <clustered>${cloudhub2.deploymentSettings.clustered}</clustered>
                <updateStrategy>${cloudhub2.deploymentSettings.updateStrategy}</updateStrategy>
                <generateDefaultPublicUrl>${cloudhub2.deploymentSettings.generateDefaultPublicUrl}</generateDefaultPublicUrl>
                <http>
                    <inbound>
                        <publicUrl>${cloudhub2.deploymentSettings.http.inbound.publicUrl}</publicUrl>
                        <forwardSslSession>${cloudhub2.deploymentSettings.http.inbound.forwardSslSession}</forwardSslSession>
                        <lastMileSecurity>${cloudhub2.deploymentSettings.http.inbound.lastMileSecurity}</lastMileSecurity>
                        <pathRewrite>${cloudhub2.deploymentSettings.http.inbound.pathRewrite}</pathRewrite>
                    </inbound>
                </http>
                <autoscaling>
                    <enabled>${cloudhub2.deploymentSettings.autoscaling.enabled}</enabled>
                    <minReplicas>${cloudhub2.deploymentSettings.autoscaling.minReplicas}</minReplicas>
                    <maxReplicas>${cloudhub2.deploymentSettings.autoscaling.maxReplicas}</maxReplicas>
                </autoscaling>
            </deploymentSettings>
            <skipDeploymentVerification>${cloudhub2.skipDeploymentVerification}</skipDeploymentVerification>
            <properties>
                <env>${cloudhub2.properties.env}</env>
                <mule.verbose.exceptions>${cloudhub2.properties.mule.verbose.exceptions}</mule.verbose.exceptions>
                <anypoint.platform.config.analytics.agent.enabled>${cloudhub2.properties.anypoint.platform.config.analytics.agent.enabled}</anypoint.platform.config.analytics.agent.enabled>
                <anypoint.platform.visualizer.layer>${cloudhub2.properties.anypoint.platform.visualizer.layer}</anypoint.platform.visualizer.layer>
            </properties>
            <secureProperties>
                <key>${cloudhub2.properties.key}</key>
                <anypoint.platform.client_id>${cloudhub2.properties.anypoint.platform.client_id}</anypoint.platform.client_id>
                <anypoint.platform.client_secret>${cloudhub2.properties.anypoint.platform.client_secret}</anypoint.platform.client_secret>
            </secureProperties>
            <integrations>
                <services>
                    <objectStoreV2>
                        <enabled>true</enabled>
                    </objectStoreV2>
                </services>
            </integrations>
        </cloudhub2Deployment>
    </configuration>
</plugin>

📌 Key Takeaways

✅ Ensure pathRewrite is under <deploymentSettings><http><inbound>
✅ Incorrect placement will cause deployment failures
✅ Double-check your configuration before upgrading

Have you run into any issues with this update? Let us know in the comments below! 🚀