During my experiences with Maven I had a few moments where I wished having some kind of iterations to go over a list of whatever (servers, environments etc.).
After some thinking about the problem i have decided to write my own plugin which will solve the problem. And now I have created such [plugin][github-iterator-maven-plugin].
Currently the plugin can be used by using it from the staging repository. After some feedback i will release it to Maven central. If you find some problems with the plugin you can create a ticket on github or write an email to me. You can use the plugin like the following:
In this case it will iterator over the given list test,prod and dev and call for every item the maven-assembly-plugin.
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
If you need you can execute several plugins as well. Just use an extra pluginExecutor for each of your plugins. So in other words: Iteration or foreach in Maven is solved.