Contact Us 1-800-596-4880

To Set Up MUnit Maven Plugin (Maven)

For MUnit to run properly with Maven, you need to add a few sections to your pom.xml file.

This documentation assumes you have the <munit.version> property in your pom.xml.

  • Enable the MUnit Maven plugin, by adding the following section to your pom.xml.

    MUnit Maven Plugin
    <build>
      <plugins>
      ...
    
        <plugin>
          <groupId>com.mulesoft.munit.tools</groupId>
          <artifactId>munit-maven-plugin</artifactId>
          <version>${munit.version}</version>
          <executions>
            <execution>
              <id>test</id>
              <phase>test</phase>
              <goals>
                <goal>test</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
    
      ...
      </plugins>
    </build>
  • Finally, you need to add the MUnit Maven Plugin, and the MUnit Plugin repositories:

    Repositories
    <repositories>
      <repository>
        <id>mulesoft-releases</id>
          <name>MuleSoft Releases Repository</name>
          <url>https://repository.mulesoft.org/releases/</url>
          <layout>default</layout>
        </repository>
    </repositories>
    Plugin Repositories
    <pluginRepositories>
      <pluginRepository>
        <id>mulesoft-release</id>
        <name>mulesoft release repository</name>
        <layout>default</layout>
        <url>https://repository.mulesoft.org/releases/</url>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
      </pluginRepository>
    </pluginRepositories>

MUnit has Surefire support built in. No additional configuration is needed.
The reports can be found under target/surefire-reports.