Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

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
    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    <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
    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    
    <repositories>
      <repository>
        <id>mulesoft-releases</id>
          <name>MuleSoft Releases Repository</name>
          <url>http://repository.mulesoft.org/releases/</url>
          <layout>default</layout>
        </repository>
    </repositories>
    Plugin Repositories
    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    <pluginRepositories>
      <pluginRepository>
        <id>mulesoft-release</id>
        <name>mulesoft release repository</name>
        <layout>default</layout>
        <url>http://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.

In this topic: