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
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • How to Build a New API Quickly Using Spring Boot and Maven
  • Configurable Feign Client Retry With Reusable Library and DRY
  • Using Lombok Library With JDK 23
  • Enhancing Software Quality with Checkstyle and PMD: A Practical Guide

Trending

  • DZone's Article Submission Guidelines
  • Docker Base Images Demystified: A Practical Guide
  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  • A Developer's Guide to Mastering Agentic AI: From Theory to Practice
  1. DZone
  2. Coding
  3. Java
  4. Mule Maven Plugin for CloudHub Deployment

Mule Maven Plugin for CloudHub Deployment

Explore the Mule Maven plugin for CloudHub deployment.

By 
Abhay Yadav user avatar
Abhay Yadav
·
Aug. 21, 19 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
18.8K Views

Join the DZone community and get the full member experience.

Join For Free

The deployment of Mule applications can be managed using Maven. The Mule Maven plugin allows integrating the packaging, testing, and deployment of Mule applications with the Maven lifecycle.

It helps in automating the application deployment.

Add the plugin in POM.xml if not added already.

<plugin>
  <groupId>org.mule.tools.maven</groupId>
  <artifactId>mule-maven-plugin</artifactId>
  <version>3.1.6</version>
  <extensions>true</extensions>
</plugin>

In the plugin, add the configuration tag to define parameters for CloudHub deployment.

<configuration>
<cloudHubDeployment>
      <uri>https://anypoint.mulesoft.com/</uri>
      <muleVersion>mule-version</muleVersion>
      <username>platform-username</username>
      <password>platform-password</password>
      <applicationName>cloudhub-application-name</applicationName>
      <environment>anypoint-environment</environment>
      <properties>
        <key>value</key>
      </properties>
  </cloudHubDeployment>
</configuration>

The properties tag can be used to define application properties if required.  

Other tags are self-explanatory, like Anypoint username, password, applicationName, etc.

The plugin gives the option to configure the region (default value is us-east-1), business group, environment to deploy to, number of workers (1 by default), vCores (0.1 by default) required, and artifact to deploy (can be mentioned by giving the absolute file location).

<region>eu-west-1</region>
<workers>1</workers>
<workerType>SMALL </workerType>
<artifact>path/to/file</artifact>

If the artifact tag is not defined, the JAR/ ZIP generated during the package phase will be used for deployment.

Accepted values for region: 

  1. us-east-1 - US East (N. Virginia)
  2. us-west-2 - US West (Oregon)
  3. eu-west-1 - EU (Ireland)
  4. ap-southeast-2 - Asia Pacific (Sydney)
  5. ap-southeast-1 - Asia Pacific (Singapore)
  6. us-west-1 - US West (N. California)
  7. eu-central-1 - EU (Frankfurt)
  8. ap-northeast-1 - Asia Pacific (Tokyo)
  9. eu-west-2 - EU (London)
  10. ca-central-1 - Canada (Central)
  11. sa-east-1 - South America (São Paulo)
  12. us-east-2 - US East (Ohio)

Accepted values for workerType: MICRO(0.1 vCores), SMALL (0.2 vCores), MEDIUM (1 vCores), LARGE (2 vCores), XLARGE (4 vCores), XXLARGE (8 vCores), 4XLARGE (16 vCores)

To deploy the application, run the maven deploy phase and one argument -DmuleDeploy

mvn clean deploy -DmuleDeploy

Without -DmuleDeploy argument, the system will throw the following exception: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter

The plugin configuration can be edited to skip passing -DmuleDeploy in command.

<executions>
  <execution>
    <id>deploy</id>
    <phase>deploy</phase>
    <goals>
      <goal>deploy</goal>
    </goals>
  </execution>
</executions>

Add the executions tag under the configuration of the plugin. Now running mvn clean deploy will deploy the application to CloudHub.

In the plugin configuration, instead of giving the Anypoint username and password, we have the option to pass server id, which will be defined under servers in the settings file of Maven. This is :

<server>
  <username>anypoint-username</username>
  <password>anypoint-password</password>
  <id>server-id</id>
</server>

Change the plugin configuration, add the server tag, and remove the username and password.

<cloudHubDeployment>
  ...
  <server>server-id</server>
  ...
</cloudHubDeployment>

Thanks for reading!

Apache Maven

Opinions expressed by DZone contributors are their own.

Related

  • How to Build a New API Quickly Using Spring Boot and Maven
  • Configurable Feign Client Retry With Reusable Library and DRY
  • Using Lombok Library With JDK 23
  • Enhancing Software Quality with Checkstyle and PMD: A Practical Guide

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!