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
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Two Engines, One Query: DuckDB Inside Neo4j
  • Testing Java and Spring Applications With Kotlin: Low-Risk to Adoption
  • Wasm Inside Neo4j: Building the Example That Didn't Exist
  • OpenAPI From Code With Spring and Java: A Recipe for Your CI

Trending

  • Decoupling a Data Pipeline From the Tables It Was Never Supposed to Depend On
  • AI Coding Agent Guardrails: Finding Gaps in Tool Permissions
  • Microsoft Fabric Throttling: Diagnose Before You Scale
  • Introduction to Error Prone: How to Catch Bugs at Compile Time

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  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
·
Aug. 21, 19 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
19.3K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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

  • Two Engines, One Query: DuckDB Inside Neo4j
  • Testing Java and Spring Applications With Kotlin: Low-Risk to Adoption
  • Wasm Inside Neo4j: Building the Example That Didn't Exist
  • OpenAPI From Code With Spring and Java: A Recipe for Your CI

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • 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