Fork me on GitHub

Iterator Maven Plugin

Overview

The invoker goal is intended to call a separate instance of Maven during your current Maven build. This is more or less equivalent to call maven from command line separately but with the help of Maven itself.

Different Working Directory

You can change the working directory for the Maven call by using:

<executions>
  <execution>
    <phase>package</phase>
    <goals>
      <goal>invoker</goal>
    </goals>
    <configuration>
      <items>
        <item>one</item>
        <item>two</item>
        <item>three</item>
      </items>
      <workingDirectory>configurations/@item@</workingDirectory>
      <goals>
        <goal>clean</goal>
        <goal>package</goal>
      </goals>
    </configuration>
  </execution>
</executions>

Different Base Directory

You can change the base directory directory for the Maven call by using:

<executions>
  <execution>
    <phase>package</phase>
    <goals>
      <goal>invoker</goal>
    </goals>
    <configuration>
      <items>
        <item>one</item>
        <item>two</item>
        <item>three</item>
      </items>
      <baseDirectory>folder/@item@</baseDirectory>
      <goals>
        <goal>clean</goal>
        <goal>package</goal>
      </goals>
    </configuration>
  </execution>
</executions>

Different goal

You can change the goal for the Maven call by using:

<executions>
  <execution>
    <phase>package</phase>
    <goals>
      <goal>invoker</goal>
    </goals>
    <configuration>
      <items>
        <item>one</item>
        <item>two</item>
        <item>three</item>
      </items>
      <goals>
        <goal>plugin-name:@item@</goal>
      <goals>
    </configuration>
  </execution>
</executions>

Different Profiles

You can change the profile for the Maven call by using:

<executions>
  <execution>
    <phase>package</phase>
    <goals>
      <goal>invoker</goal>
    </goals>
    <configuration>
      <items>
        <item>one</item>
        <item>two</item>
        <item>three</item>
      </items>
      <profiles>@item@<profiles>
    </configuration>
  </execution>
</executions>