exec:exec

Full name:

org.codehaus.mojo:exec-maven-plugin:1.3: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.

Required Parameters

Name Type Since Description
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.

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.

Optional Parameters

Name Type Since Description
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.


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 for the executed program
User property is: exec.args.
environmentVariables Map 1.1-beta-2 Environment variables to pass to the executed program.
failWithEmptyArgument boolean 1.3

This will control if you like to fail the build if an arguments element is empty. This means that for arguments which would evaluate to Null an "" empty string will be added to the command line of the executable which will be called.


Default value is: true.
failWithNullKeyOrValueInEnvironment boolean 1.3

The following will control if you like to get a warning during the build if an entry either key/value of environmentVariables will be evaluated to Null an "" empty string will be used instead.


Default value is: true.
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.
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.
Default value is: false.
User property is: 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.
workingDirectory File 1.0 The current working directory. Optional. If not specified, basedir will be used.
User property is: exec.workingdir.

Parameter Details

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

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 for the executed program
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: exec.args

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.

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: Yes
  • User Property: exec.executable

failWithEmptyArgument:

This will control if you like to fail the build if an arguments element is empty. This means that for arguments which would evaluate to Null an "" empty string will be added to the command line of the executable which will be called.

  • Type: boolean
  • Since: 1.3
  • Required: No
  • Default: true

failWithNullKeyOrValueInEnvironment:

The following will control if you like to get a warning during the build if an entry either key/value of environmentVariables will be evaluated to Null an "" empty string will be used instead.

  • Type: boolean
  • Since: 1.3
  • Required: No
  • Default: true

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

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.
  • Type: boolean
  • Since: 1.0.1
  • Required: No
  • User Property: 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

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