Your new Maven friend – the Mule Maven Plugin 2.0

September 28 2015


If you’re a Mule user, there’s a good chance that you’re using Maven to automate building and testing of your applications. We’re happy to announce Mule Maven Plugin 2.0, to help you automate your deployment and integration tests. This plugin will help you no matter where do you want it to run: CloudHub, a local Standalone server, Anypoint Runtime Manager, a local cluster or using the Mule Agent.

Continuous deployment and integration tests are a core part of software development best practices. And many of our customers are using Maven to help achieve those. The new version of our Maven plugins makes these pratices simple for Maven users. It can:

  1. Deploy and undeploy applications to different Mule environments
  2. It supports Mule Standalone, Mule Cluster, Anypoint Runtime Manager, CloudHub, and the Mule Agent
  3. It supports attaching to different lifecycle stages of Maven so you can use the plugin for both integration tests and continuous deployment.
  4. You can use the plugin with both Community and Enterprise Mule instances

Like Mule, it is licensed under Common Public Attribution License Version 1.0 and you can find the GitHub project here.

Getting Started

You can see several examples in the documentation, but here’s quick guide on how to get started. First, you need to add MuleSoft’s releases repository to your pom.xm or settings.xml so Maven can find the plugin:

We recommend to use mule-app-maven-plugin for packaging your Mule application. This way, the mule-maven-plugin will automatically pick the packaged Mule application and deploy it. Then, if you want to deploy the result of your build to CloudHub for example, add this to your Maven plugins section:

A different use case is to run integration tests in a local Mule Standalone server, before deploying to qa or prod environments. Using both maven-failsafe-plugin and mule-maven-plugin gives you a simple and efficient way to do so:

In this case the plugin will download the Mule distribution from a Maven repository (or use one that’s already installed), start the server during pre-integration-tests, and stop the server during post-integration-test phase. You only need to name your test so that it has the suffix “”.

These are just the basics, but you can also deploy domains, add third party libraries, deploy external applications, configure deployment arguments, and even run a custom Groovy script just before deploying. To get started, check out our documentation, read the release notes or try running one of the examples available in the documentation and make your build process a nice one.