iad-maven-invoker-maven-plugin
Maven Invoker maven plugin
This is a simple maven plugin wrapper for the Apache Maven Invoker which allows to invoke a Maven execution on an independent maven project.
Table of contents
- Getting started
- Example
- Unit Testing
- Parameters
- localRepository
- baseDirectory
- workingDirectory
- pomFile
- goals
- profiles
- mavenOpts
- recursive
- alsoMake
- alsoMakeDependents
- debug
- resumeFrom
- globalSettingsFile
- userSettingsFile
- mavenHome
- javaHome
- properties
- environment
- shellEnvironmentInherited
- propertiesFile
- projects
- threads
- offline
- showErrors
- updateSnapshots
- toolchainsFile
- globalToolchainsFile
- nonPluginUpdates
- globalChecksumPolicy
- reactorFailureBehavior
- timeoutInSeconds
Getting started
Check the example at example/invoker-project which builds project example/target-project.
- Clone the repo
git clone [email protected]:iarellano/iad-maven-invoker-maven-plugin.git
- From within the cloned directory, change to example project directory
cd example/invoker-project
- Execute the maven goal
mvn com.github.iarellano:iad-maven-invoker-maven-plugin:1.0:execute
Example
<plugin>
<groupId>com.github.iarellano</groupId>
<artifactId>iad-maven-invoker-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<id>build-project</id>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<baseDirectory>/path/to/other/project</baseDirectory>
<pomFile>pom.xml</pomFile>
<goals>
<goal>clean</goal>
<goal>compile</goal>
<goal>test</goal>
<goal>install</goal>
</goals>
<debug>true</debug>
</configuration>
</executions>
</plugin>
Unit Testing
- Clone the repo
git clone [email protected]:iarellano/iad-maven-invoker-maven-plugin.git
- From within the cloned directory, change to example project directory
mvn clean test
Parameters
- localRepository
- baseDirectory
- workingDirectory
- pomFile
- goals
- profiles
- mavenOpts
- recursive
- alsoMake
- alsoMakeDependents
- debug
- resumeFrom
- globalSettingsFile
- userSettingsFile
- mavenHome
- javaHome
- properties
- environment
- shellEnvironmentInherited
- propertiesFile
- projects
- threads
- offline
- showErrors
- updateSnapshots
- toolchainsFile
- globalToolchainsFile
- nonPluginUpdates
- globalChecksumPolicy
- reactorFailureBehavior
- timeoutInSeconds
localRepository
The path to the base directory of the local repository to use for the Maven invocation. Defaults to ${settings.localRepository}
.
Type | File path |
Default | ${settings.localRepository} |
Required | Yes |
baseDirectory
The path to the base directory of the POM for the Maven invocation. This setting only affects the working directory for the Maven invocation.
Type | File path |
Required | Yes |
workingDirectory
The working directory for the Maven invocation.
Type | File path |
Default | Same as baseDirectory |
Required | Yes |
pomFile
The name of the POM file for the Maven invocation which is contained in baseDirectory.
Type | String |
Default | pom.xml |
Required | Yes |
goals
The goals for the Maven invocation.
Type | List of Strings |
Required | Yes |
profiles
The profiles for the Maven invocation. Equivalent of -P
and --active-profiles
.
Type | List of Strings |
Required | No |
mavenOpts
The value of the MAVEN_OPTS
environment variable. Uses the default options if not provided.
Type | String |
Default | Default maven options |
Required | No |
recursive
Recursion behavior of a reactor invocation. Inverse equivalent of -N
and --non-recursive
. Defaults to true
.
Type | boolean |
Default | true |
Required | No |
alsoMake
Enable the 'also make' mode. Equivalent of -am
or --also-make
. Defaults to false
.
Type | boolean |
Default | false |
Required | No |
Since | 2.1 |
alsoMakeDependents
Enable the 'also make dependents' mode. Equivalent of -amd
or --also-make-dependents
.
Type | boolean |
Default | false |
Required | No |
Since | 2.1 |
debug
Enable the debug mode of the Maven invocation. Equivalent of -X
and --debug
. Defaults to false
.
Type | boolean |
Default | false |
Required | No |
resumeFrom
Resume reactor from specified project. Equivalent of -rf
or --resume-from
.
Type | String |
Required | No |
Since | 2.1 |
globalSettingsFile
The path to the global settings for the Maven invocation. Equivalent of -gs
and --global-settings
. If not provided then it uses global settings from the default location.
Type | File path |
Default | ${maven.home}/conf/settings.xml |
Required | No |
Since | 2.1 |
userSettingsFile
The path to the user settings for the Maven invocation. Equivalent of {@code -s} and {@code --settings}. If not provided then it uses the user settings from the default location.
Type | File path |
Default | ${user.home}/.m2/settings.xml |
Required | No |
mavenHome
Sets the path to the base directory of the Maven installation used to invoke Maven. This parameter may be left unspecified to use the default Maven installation which will be discovered by evaluating the system property maven.home
and the environment variable M2_HOME
. Change it if you want to use a different maven installation.
Type | File path |
Default | ${maven.home} |
Required | No |
javaHome
Sets the path to the base directory of the Java installation used to run Maven. If not provided then it uses the default Java home.
Type | No |
Default | ${java.home} |
Required | No |
properties
Additional properties to pass to the Maven invocation.
Type | Map |
Required | No |
environment
Additional environment variables to pass to the Maven invocation.
Type | Map |
Required | No |
shellEnvironmentInherited
Specifies whether the environment variables of the current process should be propagated to the Maven invocation.
Type | boolean |
Default | true |
Required | No |
propertiesFile
Path to external file containing properties to be included in the Maven invocation. Path is relative to the base directory of the project using this plugin, absolute path may be set.
Type | File path |
Required | No |
projects
Sets the reactor project list. Equivalent of -pl
or --projects
, ignored if recusive is false
.
Type | List of Strings |
Required | No |
threads
Thread count, for instance 2.0C where <em<C is core multiplied Equivalent of -T
or --threads
.
Type | String |
Required | No |
Since | 2.1 |
offline
The network mode of the Maven invocation. Equivalent of -o
and --offline
, true
if Maven should be executed in offline mode, false
if the online. Default is false
.
Type | boolean |
Default | false |
Required | No |
showErrors
Sets the exception output mode of the Maven invocation. Equivalent of -e
and --errors
. true
if Maven should print stack traces, false
otherwise. Default is false
.
Type | boolean |
Default | false |
Required | No |
updateSnapshots
Specifies whether Maven should enforce an update check for plugins and snapshots. Equivalent of -U
and --update-snapshots
. true
if plugins and snapshots should be updated, false
otherwise. Default is false
.
Type | boolen |
Default | false |
Required | No |
toolchainsFile
The alternate path for the user toolchains file Equivalent of -t
or --toolchains
.
Type | File path |
Required | No |
Since | 2.1 |
globalToolchainsFile
The alternate path for the global toolchains file Equivalent of -gt
or --global-toolchains
Type | File path |
Required | No |
Since | 3.0.0 |
nonPluginUpdates
Specifies whether Maven should check for plugin updates.
Equivalent of `-npu` or `--no-plugin-updates`
note: Ineffective with Maven3, only kept for backward compatibility
Type | boolean |
Default | false |
Required | No |
globalChecksumPolicy
Checksum mode of the Maven invocation. Equivalent of -c
or --lax-checksums
, -C
or --strict-checksums
. The checksum mode, must be one of Warn and Fail.
Type | String |
Possible values | Warn, Fail |
Required | No |
Since | 3.0.0 |
reactorFailureBehavior
Sets the failure mode of the Maven invocation. Equivalent of -ff
and --fail-fast
, -fae
and --fail-at-end
, -fn
and --fail-never
.
The failure mode, must be one of FailFast, FailAtEnd and FailNever
Type | String |
Possible values | FailFast, FailAtEnd, FailNever |
Default | FailFast |
Required | No |
Since | 3.0.0 |
timeoutInSeconds
The timeout in seconds to execute the project. A value of 0
means no timeout.
Type | int |
Default | 0 |
Required | No |
Since | 3.0.1 |