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
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • OpenAPI From Code With Spring and Java: A Recipe for Your CI
  • Tracking Dependencies Beyond the Build Stage
  • Automating Maven Dependency Upgrades Using AI
  • Web App Load Testing Using Maven Plugins for Apache JMeter, and Analyzing the Results

Trending

  • Run Gemma 4 on Your Laptop: A Hands-On Guide to Google's Latest Open Multimodal LLM
  • Data Contracts as the "Circuit Breaker" for Model Reliability
  • Dear Micromanager: Your Distrust Has a Job; It’s Just Not the One You’re Doing
  • What Is Plagiarism? How to Avoid It and Cite Sources
  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
19.1K 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

  • OpenAPI From Code With Spring and Java: A Recipe for Your CI
  • Tracking Dependencies Beyond the Build Stage
  • Automating Maven Dependency Upgrades Using AI
  • Web App Load Testing Using Maven Plugins for Apache JMeter, and Analyzing the Results

Partner Resources

×

Comments

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

  • 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