Contact Us 1-800-596-4880

Maven Reference

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.

This page summarizes reference information that helps you work when using Maven with Mule. Refer to Maven Support in Mule for an introduction and overview.

pom.xml File

<project root>/pom.xml

Project Object Model file that defines settings for a Maven project describing an application. It includes all settings necessary to build the application such as build plugin configurations. Note that the pom.xml exists on a per-project basis and is distributed along with a project.

settings.xml File

<system-wide Maven directory>/settings.xml
<user home directory>/.m2/settings.xml

Contains global settings for your Maven installation. Unlike a project’s pom.xml, it defines system-wide settings and is not distributed with a project, since it can contain confidential information such as authentication credentials.

The settings.xml file can reside in two locations:

  • In a system-wide settings folder:

    In this case, it is a global settings.xml file that defines the settings for all Maven installations on the system, regardless of user. For example:

  • In a user-specific settings folder:

    In this case, it is a user settings.xml file that is relevant only for a specific user’s Maven installation. The default location is the .m2 directory in the user’s home directory:


On a system with both global and user settings.xml files, the settings from both files become merged. In case there are duplicate settings, the user’s settings take precedence over the global settings.

MuleSoft Repositories

When you create a new Mule project in Anypoint Studio, the required MuleSoft repositories are automatically added to the project. If you create the Mule project outside Studio, you have to manually add the repositories to the pom.xml file and also configure your credentials for Maven to access the enterprise repository.

Configure MuleSoft Public Repositories

To configure the public MuleSoft repositories, add the following to your project’s pom.xml file:

        <name>Anypoint Exchange</name>
        <name>MuleSoft Releases Repository</name>
        <name>MuleSoft Releases Repository</name>

Configure MuleSoft Enterprise Repository

To add access to the enterprise repository to your project, you must obtain and install an Enterprise license, acquire access to the repository, and configure the repository in your project.

Obtain and Install an Enterprise License

See Install an Enterprise License, for instructions to acquire or install an Enterprise license

Acquire Access to Enterprise Repositories

If you are a MuleSoft customer and do not have credentials to access the MuleSoft Enterprise repository, contact Support and request Nexus enterprise credentials.

Configure Maven to Access MuleSoft Enterprise Repository

To configure Maven to access the enterprise repository:

  1. Navigate to <USER_HOME>/.m2/settings.xml.

  2. Open settings.xml on all workstations that require access. If the settings.xml file does not exist, create it.

    Read more about the settings.xml file in the Maven documentation.

  3. Add the following syntax to the servers section in each settings.xml file:

  4. Add the following syntax to the profile section in each settings.xml file:


Useful Commands

The following set of commands enables you to retrieve information about your Maven installation and to perform project-related tasks.

Locate the Maven binary and other files (Unix)

whereis mvn

Locate Maven files such as global configuration files (Unix)

locate maven

Obtain Maven version

mvn --version

This also provides other information such as the Java home directory, locale and processor architecture.

Obtain a List of Maven Commands and Options

mvn -h

Check the Manual Page for Maven (Unix)

man mvn

Create a Project

mvn archetype:generate -DartifactId=myapp -DarchetypeArtifactId=myarchetypeid -DinteractiveMode=false

Build a Project

mvn package

Clean a Project

mvn clean

Generate a Site

mvn site

Obtain a List of JAR Files Included in Your Artifact

mvn dependency:build-classpath

Obtain the Dependency Tree for Your Artifact

mvn dependency:tree

Deploying Mule Artifacts to a Central Maven Repository

Using a central repository can save users' time when building applications. To deploy to a central repository, you need to deploy the Mule POM files and JAR artifacts to the desired repository.

The deploy plugin is primarily used during the deploy phase, to add your artifacts to a remote repository for sharing with other developers and projects.

Deploying pom.xml

To deploy the pom.xml to a remote repository, use the following command:

mvn deploy:deploy-file

For the -Durl parameter, replace <your_repository_ip> with the correct IP address. Also, the -DrepositoryId needs to match with the credentials defined in the settings.xml file.

Deploying the JAR files

To deploy a JAR file to a remote repository, use the following command:

mvn deploy:deploy-file

For the -Durl parameter, replace your_repository_ip with the correct IP address. Also, the -DrepositoryId needs to match with the credentials defined in the settings.xml file.

If you wish to both install the JAR files locally and deploy them remotely, you can keep both locations in the argument definition.