Fork me on GitHub

Usage

Lets assume you would like to call the maven-echo-plugin several times. Apart form being really useful it's for an example. This can be achieved by the following:

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<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>
        <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>

This will produce the following output during a mvn clean package call which will show you the messages produced by the maven-echo-plugin and their appropriate values.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[INFO] Scanning for projects...
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building Iterator Executor Invoker Maven Plugin outputWithoutDebugTest 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ basic-test ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ basic-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/iterator/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ basic-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ basic-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/iterator/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ basic-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ basic-test ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ basic-test ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /home/iterator/target/basic-test-0.1-SNAPSHOT.jar
[INFO]
[INFO] --- iterator-maven-plugin:0.5.1:iterator (default) @ basic-test ---
[INFO] ------ (one) com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
[INFO] This is a message: one
[INFO] ------ (two) com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
[INFO] This is a message: two
[INFO] ------ (three) com.soebes.maven.plugins:maven-echo-plugin:0.1:echo
[INFO] This is a message: three
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.438 s
[INFO] Finished at: 2017-08-07T19:17:46+02:00
[INFO] Final Memory: 12M/245M
[INFO] ------------------------------------------------------------------------