<commit_before>Iterator Maven Plugin
=====================

[![Build Status](https://buildhive.cloudbees.com/job/khmarbaise/job/iterator-maven-plugin/badge/icon)](https://buildhive.cloudbees.com/job/khmarbaise/job/iterator-maven-plugin/)

Overview
--------

The iterator-maven-plugin is intended to make iterations on a list possible. This means
to execute other plugins or Maven itself based on the iteratorion of the given
elements.

This is in the majority of the cases based on wrong decoupling the configuration
from the artifacts (like webapp, ear etc.).


- - -

__BY USING THIS PLUGIN YOU ACKNOWLEDGE THAT YOU ARE A BAD CITIZEN OF THE MAVEN ECOSYSTEM.__

- - -


License
-------
[Apache License, Version 2.0, January 2004](http://www.apache.org/licenses/)

Homepage
--------
[http://khmarbaise.github.com/iterator-maven-plugin/](http://khmarbaise.github.com/iterator-maven-plugin/)

Description
-----------

It might be helpful to create a plugin which is able to call a plugin on
iterating through some kind of data.

For example:

The following possible solutions exist:

    <build>
      <plugins>
        <plugin>
          <groupId>com.soebes.maven.plugins</groupId>
          <artifactId>iterator-maven-plugin</artifactId>
          <version>0.2</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>executor</goal>
              </goals>
              <configuration>
                <items>
                  <item>one</item>
                  <item>two</item>
                  <item>three</item>
                </items>
                <pluginExecutors>
                  <pluginExecutor>
                    <plugin>
                      <groupId>com.soebes.maven.plugins</groupId>
                      <artifactId>maven-echo-plugin</artifactId>
                      <version>0.1</version>
                    </plugin>
                    <goal>echo</goal>
                    <configuration>
                      <echos>
                        <echo>This is a message: @item@</echo>
                      </echos>
                    </configuration>
                  </pluginExecutor>
                </pluginExecutors>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>

The result of the above configuration is that the [maven-echo-plugin](https://github.com/khmarbaise/Maven-Echo-Plugin/)
will be called three times like the following:

    [INFO] 
    [INFO] --- iterator-maven-plugin:0.2:executor (default) @ basic-test ---
    [INFO]  ------ com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
    [INFO] This is a message: one
    [INFO]  ------ com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
    [INFO] This is a message: two
    [INFO]  ------ com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
    [INFO] This is a message: three
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------


The result of the above can of course be achieved by using an appropriate number
of execution blocks, but it will become cumbersome in particular if you have
a larger number of executions (for example 10 or more).

An other example how the iterator-maven-plugin can make your life easier will be shown 
here:


      <plugin>
        <groupId>com.soebes.maven.plugins</groupId>
        <artifactId>iterator-maven-plugin</artifactId>
        <version>0.2</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>executor</goal>
            </goals>
            <configuration>
              <items>
                <item>test</item>
                <item>prod</item>
                <item>dev</item>
              </items>
              <pluginExecutors>
                <pluginExecutor>
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.4</version>
                  </plugin>
                  <goal>single</goal>
                  <configuration>
                    <descriptors>
                      <descriptor>${project.basedir}/@item@.xml</descriptor>
                    </descriptors>
                  </configuration>
                </pluginExecutor>
              </pluginExecutors>
            </configuration>
          </execution>
        </executions>
      </plugin>


In the above example the iteration variable *@item@* is used to access
the different assembly descriptor files in the project base directory.



Having a property which contains a list of servers like this:

    list_of_servers=host1, host2, host3

    for (server : list_of_servers) {
      call mvn -D$server
    }

    for (server : list_of_servers) {
      call mvn -Dgoal=$server
    }

    for (server : list_of_servers) {
      call $server/mvn -Dserver=$server clean package
    }



      <plugin>
        <groupId>com.soebes.maven.plugins</groupId>
        <artifactId>iterator-maven-plugin</artifactId>
        <version>0.2</version>
        <executions><commit_msg>- Cleaned up documentation - Upgraded to 0.3<commit_after>Iterator Maven Plugin
=====================

[![Build Status](https://buildhive.cloudbees.com/job/khmarbaise/job/iterator-maven-plugin/badge/icon)](https://buildhive.cloudbees.com/job/khmarbaise/job/iterator-maven-plugin/)

Overview
--------

The iterator-maven-plugin is intended to make iterations on a list possible. This means
to execute other plugins or Maven itself based on the iteratorion of the given
elements.

This is in the majority of the cases based on wrong decoupling the configuration
from the artifacts (like webapp, ear etc.).


License
-------
[Apache License, Version 2.0, January 2004](http://www.apache.org/licenses/)

Homepage
--------
[http://khmarbaise.github.com/iterator-maven-plugin/](http://khmarbaise.github.com/iterator-maven-plugin/)

Description
-----------

It might be helpful to create a plugin which is able to call a plugin on
iterating through some kind of data.

For example:

The following possible solutions exist:

    <build>
      <plugins>
        <plugin>
          <groupId>com.soebes.maven.plugins</groupId>
          <artifactId>iterator-maven-plugin</artifactId>
          <version>0.3</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>executor</goal>
              </goals>
              <configuration>
                <items>
                  <item>one</item>
                  <item>two</item>
                  <item>three</item>
                </items>
                <pluginExecutors>
                  <pluginExecutor>
                    <plugin>
                      <groupId>com.soebes.maven.plugins</groupId>
                      <artifactId>maven-echo-plugin</artifactId>
                      <version>0.1</version>
                    </plugin>
                    <goal>echo</goal>
                    <configuration>
                      <echos>
                        <echo>This is a message: @item@</echo>
                      </echos>
                    </configuration>
                  </pluginExecutor>
                </pluginExecutors>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>

The result of the above configuration is that the [maven-echo-plugin](https://github.com/khmarbaise/Maven-Echo-Plugin/)
will be called three times like the following:

    [INFO] 
    [INFO] --- iterator-maven-plugin:0.2:executor (default) @ basic-test ---
    [INFO]  ------ com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
    [INFO] This is a message: one
    [INFO]  ------ com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
    [INFO] This is a message: two
    [INFO]  ------ com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
    [INFO] This is a message: three
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------


The result of the above can of course be achieved by using an appropriate number
of execution blocks, but it will become cumbersome in particular if you have
a larger number of executions (for example 10 or more).

An other example how the iterator-maven-plugin can make your life easier will be shown 
here:


      <plugin>
        <groupId>com.soebes.maven.plugins</groupId>
        <artifactId>iterator-maven-plugin</artifactId>
        <version>0.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>executor</goal>
            </goals>
            <configuration>
              <items>
                <item>test</item>
                <item>prod</item>
                <item>dev</item>
              </items>
              <pluginExecutors>
                <pluginExecutor>
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.4</version>
                  </plugin>
                  <goal>single</goal>
                  <configuration>
                    <descriptors>
                      <descriptor>${project.basedir}/@item@.xml</descriptor>
                    </descriptors>
                  </configuration>
                </pluginExecutor>
              </pluginExecutors>
            </configuration>
          </execution>
        </executions>
      </plugin>


In the above example the iteration variable *@item@* is used to access
the different assembly descriptor files in the project base directory.



Having a property which contains a list of servers like this:

    list_of_servers=host1, host2, host3

    for (server : list_of_servers) {
      call mvn -D$server
    }

    for (server : list_of_servers) {
      call mvn -Dgoal=$server
    }

    for (server : list_of_servers) {
      call $server/mvn -Dserver=$server clean package
    }



      <plugin>
        <groupId>com.soebes.maven.plugins</groupId>
        <artifactId>iterator-maven-plugin</artifactId>
        <version>0.3</version>
        <executions>
{'fraction_non_alphanumeric': 0.14062055223455736, 'fraction_numerical': 0.00569313976658127, 'mean_word_length': 1.629740518962076, 'pattern_counts': {'":': 0, '<': 219, '<?xml version=': 0, '>': 219, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4342632', 'n_tokens_mistral': 2985, 'n_tokens_neox': 2708, 'n_words': 697}