Contact Us 1-800-596-4880

Maven Support in Mule

This version of Mule reached its End of Life on May 2, 2023, when Extended Support ended.

Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted.

MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements.

Mule Maven plugin versions 3.0.0, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, and 3.8.3 are deprecated.

Maven is a project management utility that Mule implements to enhance project development. Mule provides built-in Maven functionality, including the following features:

  • Anypoint Exchange

    • Connectors in Anypoint Exchange provide Maven dependency information. In Anypoint Exchange, you can click a connector asset and click Dependency Snippets to list the Maven pom.xml file dependency.

  • Anypoint Studio

    • All new projects created in Anypoint Studio 7 and later are configured with Maven by default. You can run the project with Maven from the command line, or run it directly from Anypoint Studio.

    • You can import an existing Maven project into Anypoint Studio and continue working on it. See Importing and Exporting Projects for more details.

  • Mule Runtime Engine

    • You can integrate the packaging, testing, and deployment of your Mule applications with your Maven lifecycle using the Mule Maven plugin.

Prerequisites

You must be familiar with Maven concepts like managing pom.xml files and working with Maven plugins. If you are just getting started with Maven, we suggest you follow Maven’s Getting Started tutorial.

Benefits

Maven facilitates the management of your Mule applications both inside and outside of Anypoint Studio, providing the following benefits:

  • When you create a new Mule project using Anypoint Studio, you can be confident that you are working with the correct Mule project folder structure and the basic set of standard dependencies.

  • Anypoint Studio automatically manages your POM file every time you add new elements to your flow that require additional dependencies.

  • The Maven POM file makes sharing projects easier and more lightweight because the POM references the dependencies so that you don’t have to manually find and include every dependency within the project itself.

  • Using Maven to manage the builds ensures that the resulting final build is sanitized and standardized.

  • You can program automatic builds using external frameworks such as Bamboo for continuous integration.

Recommendations

  • Use Anypoint Studio to design your applications.

    Anypoint Studio’s built-in Maven support minimizes the chances that you would have to manually update your POM file with new dependencies as you add to, or modify your applications.

  • Update your POM file and settings.xml when necessary.

    When updating your POM file, the <packaging>…</packaging> tag is mandatory. Depending on the type of project you are creating, valid values for this tag are mule-application, mule-domain, mule-policy, and mule-domain-bundle. For example, if you create a Mule project using Anypoint Studio, the tag is automatically configured as <packaging>mule-application</packaging>.

    If you create Maven projects from the command line using archetypes, you need to manage your POM file manually, and in some cases, adjust your settings.xml file to point to the MuleSoft Enterprise repository and supply credentials. In some cases, even if you manage your project with Anypoint Studio, you may need to make manual adjustments to your POM as well.

  • Use SNAPSHOT version.

    SNAPSHOT enables you to identify versions of your project as you work toward producing a stable product to release. For example, you can build a 1.0.0-SNAPSHOT version of your project, test functionality, make changes, etc. until you are ready to release it as version 1.0.0. Then you can build upon using a new version, 1.1.0-SNAPSHOT.

    Example XML:

    <groupId>com.mycompany</groupId>
    <artifactId>my-application</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>mule-application</packaging>