Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khmarbaise/iterator-maven-plugin
iterator-maven-plugin
https://github.com/khmarbaise/iterator-maven-plugin
maven maven-plugin
Last synced: 3 months ago
JSON representation
iterator-maven-plugin
- Host: GitHub
- URL: https://github.com/khmarbaise/iterator-maven-plugin
- Owner: khmarbaise
- License: apache-2.0
- Created: 2013-03-29T18:51:05.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2022-03-01T13:36:55.000Z (almost 3 years ago)
- Last Synced: 2024-10-03T15:32:03.934Z (4 months ago)
- Topics: maven, maven-plugin
- Language: Java
- Homepage: http://khmarbaise.github.com/iterator-maven-plugin/
- Size: 1.6 MB
- Stars: 33
- Watchers: 4
- Forks: 20
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Iterator Maven Plugin
=====================[![Build Status](https://travis-ci.org/khmarbaise/iterator-maven-plugin.svg?branch=master)](https://travis-ci.org/khmarbaise/iterator-maven-plugin)
[![Maven Central](https://img.shields.io/maven-central/v/com.soebes.maven.plugins/iterator-maven-plugin.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Ccom.soebes.maven.plugins)
[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/khmarbaise/iterator-maven-plugin.svg?label=License)](http://www.apache.org/licenses/)Build Status
------------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 iteratation 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.).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:
com.soebes.maven.plugins
iterator-maven-plugin
0.5.0
package
iterator
one
two
three
com.soebes.maven.plugins
echo-maven-plugin
0.3
echo
This is a message: @item@
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.5.0: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] ------------------------------------------------------------------------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:
com.soebes.maven.plugins
iterator-maven-plugin
0.5.0
package
iterator
test
prod
dev
org.apache.maven.plugins
maven-assembly-plugin
2.4
single
${project.basedir}/@[email protected]
In the above example the iteration variable *@item@* is used to access
the different assembly descriptor files in the project base directory.It is also possible to iterator over a list of folders which means you can
configure iterator-maven-plugin like the following:
com.soebes.maven.plugins
iterator-maven-plugin
0.5.0
package
iterator
src/main/java/com/soebes/maven/multiple/
com.soebes.maven.plugins
maven-echo-plugin
echo
This is a message: @item@
org.apache.maven.plugins
maven-jar-plugin
jar
com/soebes/maven/multiple/@item@/**
@item@
You can see what is possible, but i can not recommend to do things
like this in particular calling the maven-jar-plugin like this.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
}
com.soebes.maven.plugins
iterator-maven-plugin
0.5.0
package
invoker
test
prod
dev
clean
package
${project.basedir}/maven-calls/@item@/pom.xml
@item@
cd maven-calls/@item@/
mvn -Dgoal=@item@ -f pom.xml clean package
host1,host2,host3
,
..
s1,s2,s3,s4
...
..
..
..Whatever configuration Replacement @value@
Idea to use key/value pairs.
key1, value11, value12, value13
key2, value21, value22, value23First iteration:
@item.value.0@ => value11
@item.value.1@ => value12@item.key@ => key1
Note
----Starting with version 0.3 of iterator-maven-plugin the goal executor has
been renamed to iterator cause it represents better the meaning.Status
------TODOs
-----Usage
-----see homepage.