The basic idea of this plugin is to make iterations over a list of values possible. This means having a list of values like: one, two, three and execute other plugins or Maven instances and give the current value as a parameter to the plugin or to the appropriate Maven call.
But more practical might be to think about the list as a list of environments like production, test, qa, development etc. This list of environments can be defined in the configuration area of the plugin like this:
<items> <item>production</item> <item>test</item> <item>qa</item> <item>development</item> </items>
It is also possible to define the list of environments like this:
<content>production,test,qa,development</content>
A special configuration can be used to define the items and properties in combination.
<itemsWithProperties> <itemWithProperty> <name>production</name> <properties> <key>value1</key> </properties> </itemWithProperty> <itemWithProperty> <name>test</name> <properties> <key>value2</key> </properties> </itemWithProperty> <itemWithProperty> <name>qa</name> <properties> <key>value3</key> </properties> </itemWithProperty> <itemWithProperty> <name>development</name> <properties> <key>value4</key> </properties> </itemWithProperty> </itemsWithProperties>
Use whatever fits your needs better.
There are currently two goals iterator and invoker. The iterator goal is intended to call one or more plugins during the iterations over the given list of items where as the invoker is intended to call Maven during the iterations.
A pseudo code equivalent would look like the following:
List items = [prod, test, qa] foreach (item : items) { execute.Plugin (item) }
The invoker goal is intended to call a separate maven instance, like calling maven on command line, with the different possibilities of giving the iterated item.
A pseudo code equivalent would look like the following:
List items = [prod, test, qa] foreach (item : items) { mvn -P${item} package }
The iterator-maven-plugin can be bound to any lifecycle phase you like.
<project> ... <build> <plugins> <plugin> <groupId>com.soebes.maven.plugins</groupId> <artifactId>iterator-maven-plugin</artifactId> <version>0.5.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>iterator</goal> </goals> <configuration> <pluginExecutors> <pluginExecutor> .. </pluginExecutor> <pluginExecutor> .. </pluginExecutor> </pluginExecutors> </configuration> </execution> </executions> </plugin> </plugins> </build> ... </project>