Maven Run/Build Plugin 2

maven-run-plugin-1.0.jar

This is a simplified and more flexible version of build plugin.

This plugin allows to execute specified goals on all project and sub projects under current base directory.

The plugin is using “maven.multiproject.type” and “command” property to determine project and command types in order to execure appropriate list of goals.

The plugin will append the value specified in “maven.multiproject.type” and “command” properties to “.goals” to get list of maven goals to run.

NOTE: There should not be any space in goals or ignore failures list.

Use cases:

1. Command specified but no goals and ignore failurs are specified. The command will be used as goal name.

#Goal
maven -Dcommand=clean run

#Property Files (build.properties or project.properties at base or parent level)
Nothing

OR

#Goal
maven run

#Property Files (build.properties or project.properties at base or parent level)
command=clean

Will run clean goal on base and sub projects.

2. Command, goals and ingnore failures are specified.

#Goal
maven -Dcommand=build run

#Property Files (build.properties or project.properties at base or parent level)
jar.build.goals = clean,jar:jar,jar:install
ejb.build.goals = clean,ejb:ejb,ejb:install
war.build.goals = clean,war:war,war:install
ear.build.goals = clean,ear:ear,ear:install

OR

#Goal
maven run

#Property Files (build.properties or project.properties at base or parent level)
command=build
jar.build.goals = clean,jar:jar,jar:install
ejb.build.goals = clean,ejb:ejb,ejb:install
war.build.goals = clean,war:war,war:install
ear.build.goals = clean,ear:ear,ear:install

Will run “clean” ,”jar:jar” and “jar:install” on jar project, “clean” ,
“ejb:ejb” and “ejb:install” on ejb project an same for war and ear.

3. If “command” or “maven.multiproject.type” are not specified the plugin will
replace them with empty string.
The following will achieve same as above, since command is not specified it
is replaced with empty string in goals:

#Goal
maven run

#Property Files (build.properties or project.properties at base or parent level)
jar..goals = clean,jar:jar,jar:install
ejb..goals = clean,ejb:ejb,ejb:install
war..goals = clean,war:war,war:install
ear..goals = clean,ear:ear,ear:install

4. Optionally you can specify the “ignore.failures” property which will be used during maven reactor. For example the first goal will be run with ignoreFailures=true the rest with ignoreFailures=false

jar.build.goals = clean,jar:jar,jar:install
jar.build.ignore.failures = true,false,false

5. If ignore is omitted for particular goal it will be replaced with last ignore. For example this will acieve the same as above:

jar.build.goals = clean,jar:jar,jar:install
jar.build.ignore.failures = true,false

6. If nothing is specified or is undefined in ignore failures list
it will be replaced with “true” value:
For example these two will acieve the same as above:

jar.build.goals = clean,jar:jar,jar:install
jar.build.ignore.failures = ,false,false

OR

jar.build.goals = clean,jar:jar,jar:install
jar.build.ignore.failures = fsdfdsf,false,false

1 comment to Maven Run/Build Plugin 2

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>