Fork me on GitHub

exec:exec

Full name:

org.codehaus.mojo:exec-maven-plugin:1.6.0:exec

Description:

A Plugin for executing external programs.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • The goal is thread-safe and supports parallel builds.
  • Since version: 1.0.

Optional Parameters

Name Type Since Description
addOutputToClasspath boolean 1.5.1 Add project output directory to classpath. This might be undesirable when the exec plugin is run before the compile step. Default is true.
Default value is: true.
User property is: addOutputToClasspath.
addResourcesToClasspath boolean 1.5.1 Add project resource directories to classpath. This is especially useful if the exec plugin is used for a code generator that reads its settings from the classpath.
Default value is: false.
User property is: addResourcesToClasspath.
arguments List 1.0

A list of arguments passed to the executable, which should be of type <argument> or <classpath>. Can be overridden by using the exec.args environment variable.


async boolean 1.0 If set to true the child process executes asynchronously and build execution continues in parallel.
Default value is: false.
User property is: exec.async.
asyncDestroyOnShutdown boolean 1.0 If set to true, the asynchronous child process is destroyed upon JVM shutdown. If set to false, asynchronous child process continues execution after JVM shutdown. Applies only to asynchronous processes; ignored for synchronous processes.
Default value is: true.
User property is: exec.asyncDestroyOnShutdown.
classpathScope String 1.0 Defines the scope of the classpath passed to the plugin. Set to compile,test,runtime or system depending on your needs. Since 1.1.2, the default value is 'runtime' instead of 'compile'.
Default value is: runtime.
User property is: exec.classpathScope.
commandlineArgs String 1.0 Arguments separated by space for the executed program. For example: "-j 20"
User property is: exec.args.
environmentScript File 1.4.0 Environment script to be merged with environmentVariables This script is platform specifics, on Unix its must be Bourne shell format. Use this feature if you have a need to create environment variable dynamically such as invoking Visual Studio environment script file
environmentVariables Map 1.1-beta-2 Environment variables to pass to the executed program.
executable String 1.0

The executable. Can be a full path or the name of the executable. In the latter case, the executable must be in the PATH for the execution to work. Omit when using executableDependency.

The plugin will search for the executable in the following order:

  1. relative to the root of the project
  2. as toolchain executable
  3. relative to the working directory (Windows only)
  4. relative to the directories specified in the system property PATH (Windows Only)
Otherwise use the executable as is.


User property is: exec.executable.
executableDependency ExecutableDependency 1.1-beta-1 If provided the ExecutableDependency identifies which of the plugin dependencies contains the executable class. This will have the affect of only including plugin dependencies required by the identified ExecutableDependency.

If includeProjectDependencies is set to true, all of the project dependencies will be included on the executable's classpath. Whether a particular project dependency is a dependency of the identified ExecutableDependency will be irrelevant to its inclusion in the classpath.


longClasspath boolean 1.1.2 If set to true the classpath and the main class will be written to a MANIFEST.MF file and wrapped into a jar. Instead of '-classpath/-cp CLASSPATH mainClass' the exec plugin executes '-jar maven-exec.jar'.
Default value is: false.
User property is: exec.longClasspath.
longModulepath boolean 1.1.2 If set to true the modulepath and the main class will be written as an @arg file Instead of '--module-path/-p MODULEPATH ' the exec plugin executes '@modulepath'.
Default value is: true.
User property is: exec.longModulepath.
outputFile File 1.1-beta-2 Program standard and error output will be redirected to the file specified by this optional field. If not specified the standard Maven logging is used.
Note: Be aware that System.out and System.err use buffering, so don't rely on the order!
User property is: exec.outputFile.
skip boolean 1.0.1 Skip the execution. Starting with version 1.4.0 the former name skip has been changed into exec.skip.
Default value is: false.
User property is: exec.skip.
sourceRoot File 1.0 This folder is added to the list of those folders containing source to be compiled. Use this if your plugin generates source code.
User property is: sourceRoot.
successCodes int[] 1.1.1 Exit codes to be resolved as successful execution for non-compliant applications (applications not returning 0 for success).
testSourceRoot File 1.0 This folder is added to the list of those folders containing source to be compiled for testing. Use this if your plugin generates test source code.
User property is: testSourceRoot.
toolchain String 1.0

The toolchain. If omitted, "jdk" is assumed.


Default value is: jdk.
User property is: exec.toolchain.
workingDirectory File 1.0 The current working directory. Optional. If not specified, basedir will be used.
User property is: exec.workingdir.

Parameter Details

addOutputToClasspath:

Add project output directory to classpath. This might be undesirable when the exec plugin is run before the compile step. Default is true.
  • Type: boolean
  • Since: 1.5.1
  • Required: No
  • User Property: addOutputToClasspath
  • Default: true

addResourcesToClasspath:

Add project resource directories to classpath. This is especially useful if the exec plugin is used for a code generator that reads its settings from the classpath.
  • Type: boolean
  • Since: 1.5.1
  • Required: No
  • User Property: addResourcesToClasspath
  • Default: false

arguments:

A list of arguments passed to the executable, which should be of type <argument> or <classpath>. Can be overridden by using the exec.args environment variable.

  • Type: java.util.List
  • Since: 1.0
  • Required: No

async:

If set to true the child process executes asynchronously and build execution continues in parallel.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: exec.async
  • Default: false

asyncDestroyOnShutdown:

If set to true, the asynchronous child process is destroyed upon JVM shutdown. If set to false, asynchronous child process continues execution after JVM shutdown. Applies only to asynchronous processes; ignored for synchronous processes.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: exec.asyncDestroyOnShutdown
  • Default: true

classpathScope:

Defines the scope of the classpath passed to the plugin. Set to compile,test,runtime or system depending on your needs. Since 1.1.2, the default value is 'runtime' instead of 'compile'.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: exec.classpathScope
  • Default: runtime

commandlineArgs:

Arguments separated by space for the executed program. For example: "-j 20"
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: exec.args

environmentScript:

Environment script to be merged with environmentVariables This script is platform specifics, on Unix its must be Bourne shell format. Use this feature if you have a need to create environment variable dynamically such as invoking Visual Studio environment script file
  • Type: java.io.File
  • Since: 1.4.0
  • Required: No

environmentVariables:

Environment variables to pass to the executed program.
  • Type: java.util.Map
  • Since: 1.1-beta-2
  • Required: No

executable:

The executable. Can be a full path or the name of the executable. In the latter case, the executable must be in the PATH for the execution to work. Omit when using executableDependency.

The plugin will search for the executable in the following order:

  1. relative to the root of the project
  2. as toolchain executable
  3. relative to the working directory (Windows only)
  4. relative to the directories specified in the system property PATH (Windows Only)
Otherwise use the executable as is.

  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: exec.executable

executableDependency:

If provided the ExecutableDependency identifies which of the plugin dependencies contains the executable class. This will have the affect of only including plugin dependencies required by the identified ExecutableDependency.

If includeProjectDependencies is set to true, all of the project dependencies will be included on the executable's classpath. Whether a particular project dependency is a dependency of the identified ExecutableDependency will be irrelevant to its inclusion in the classpath.

  • Type: org.codehaus.mojo.exec.ExecutableDependency
  • Since: 1.1-beta-1
  • Required: No

longClasspath:

If set to true the classpath and the main class will be written to a MANIFEST.MF file and wrapped into a jar. Instead of '-classpath/-cp CLASSPATH mainClass' the exec plugin executes '-jar maven-exec.jar'.
  • Type: boolean
  • Since: 1.1.2
  • Required: No
  • User Property: exec.longClasspath
  • Default: false

longModulepath:

If set to true the modulepath and the main class will be written as an @arg file Instead of '--module-path/-p MODULEPATH ' the exec plugin executes '@modulepath'.
  • Type: boolean
  • Since: 1.1.2
  • Required: No
  • User Property: exec.longModulepath
  • Default: true

outputFile:

Program standard and error output will be redirected to the file specified by this optional field. If not specified the standard Maven logging is used.
Note: Be aware that System.out and System.err use buffering, so don't rely on the order!
  • Type: java.io.File
  • Since: 1.1-beta-2
  • Required: No
  • User Property: exec.outputFile

skip:

Skip the execution. Starting with version 1.4.0 the former name skip has been changed into exec.skip.
  • Type: boolean
  • Since: 1.0.1
  • Required: No
  • User Property: exec.skip
  • Default: false

sourceRoot:

This folder is added to the list of those folders containing source to be compiled. Use this if your plugin generates source code.
  • Type: java.io.File
  • Since: 1.0
  • Required: No
  • User Property: sourceRoot

successCodes:

Exit codes to be resolved as successful execution for non-compliant applications (applications not returning 0 for success).
  • Type: int[]
  • Since: 1.1.1
  • Required: No

testSourceRoot:

This folder is added to the list of those folders containing source to be compiled for testing. Use this if your plugin generates test source code.
  • Type: java.io.File
  • Since: 1.0
  • Required: No
  • User Property: testSourceRoot

toolchain:

The toolchain. If omitted, "jdk" is assumed.

  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: exec.toolchain
  • Default: jdk

workingDirectory:

The current working directory. Optional. If not specified, basedir will be used.
  • Type: java.io.File
  • Since: 1.0
  • Required: No
  • User Property: exec.workingdir