How to deploy existing artifact with Mule Maven Plugin


Mule Maven plugin provides a way to deploy Mule applications. In Mule Maven Deployment and Jenkins Pipeline article we learned how to use Mule Maven Plugin to deploy Mule 3 applications during maven builds. In this tip, we will see how to deploy existing artifacts with Mule Maven plugin.

As a part of CI/CD pipelines, we may not build and deploy Mule applications in single step. It may be required to perform build the application first using mvn package phase. Then, try to deploy it using mvn deploy phase. If you have guessed that, deploy will re-build the application, then you got it right. By default, this plugin will build the artifact and use it for deployment.

In this approach, we can give our artifact path to this plugin. We will use -Dmule.artifact parameter on CLI for this purpose. In our standalone deployment example from Mule Maven Deployment and Jenkins Pipeline demo, let’s try to separate our package and deploy steps as -

  • Package Application

  • Copy Generated Application to package folder

  • Deploy application from package folder.

Here is a terminal recording showing this in action:

Executed Maven commands -

  • mkdir package

  • mvn clean package

  • cp target/mule-maven-deployment-demo-1.0.0-SNAPSHOT-b0.zip package/

  • mvn deploy -Dmule.home=/Volumes/MM/DevTools/mule/mule-standalone-3.9.0 -P standalone -Dmule.artifact=package/mule-maven-deployment-demo-1.0.0-SNAPSHOT-b0.zip

Log output shows the deployed artifact-

[INFO] --- mule-maven-plugin:2.3.3:deploy (deploy) @ mule-maven-deployment-demo ---
[INFO] Deploying artifact mule-maven-deployment-demo
[INFO] Checking if Mule Runtime is running.
[INFO] Executing: /Volumes/MM/DevTools/mule/mule-standalone-3.9.0/bin/mule status
MULE_HOME is set to /Volumes/MM/DevTools/mule/mule-standalone-3.9.0
Mule is running (22967).
[INFO] Domain configuration not found: null
[INFO] Waiting for artifact [package/mule-maven-deployment-demo.zip] to be deployed.
[INFO] Artifact mule-maven-deployment-demo deployed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

That is all for now! Hopefully, this tip will help you writing your CI/CD pipelines for existing artifacts.

on twitter to get updates on new posts.

Stay updated!

On this blog, I post articles about different technologies like Java, MuleSoft, and much more.

You can get updates for new Posts in your email by subscribing to JavaStreets feed here -


Lives on Java Planet, Walks on Java Streets, Read/Writes in Java, JCP member, Jakarta EE enthusiast, MuleSoft Integration Architect, MuleSoft Community Ambassador, Open Source Contributor and Supporter, also writes at Unit Testers, A Family man!