### Shell script for useMavenLogger example
Source: https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html
Example script that echoes the project artifactId and a counter from 1 to 100. Used to illustrate the effect of the useMavenLogger option in multithreaded builds.
```bash
for i in {1..100}
do
echo "${project.artifactId} - $i"
done
```
--------------------------------
### Example POM Configuration using Plugin Dependencies
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-plugin-dependencies.html
Configures the exec-maven-plugin to use plugin dependencies instead of project dependencies. Sets includeProjectDependencies to false and includePluginDependencies to true, and uses executableDependency to specify the artifact containing the main class. Includes the plugin dependency declaration for the executable class.
```xml
...
org.codehaus.mojo
exec-maven-plugin
3.6.4
...
java
false
true
com.example.myproject
mylib
com.example.Main
argument1
...
myproperty
myvalue
...
com.example.myproject
mylib
1.3.5
jar
...
```
--------------------------------
### Example Runnable with constructor injection
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-java-runnable.html
Java example of a Runnable class that uses constructor injection for a version resolver, system properties, and a system properties updater. The run method reads a property and updates it with a boolean indicating whether the resolver is present.
```java
public class HelloRunnable implements Runnable {
private final Function versionResolver;
private final Properties properties;
private final BiConsumer updater;
public HelloRunnable(
final Function highestVersionResolver,
final Properties systemProperties,
final BiConsumer systemPropertiesUpdater) {
this.versionResolver = highestVersionResolver;
this.properties = systemProperties;
this.updater = systemPropertiesUpdater;
}
public void run() {
final String v = properties.getProperty("test.version");
updater.accept("hello.runnable.output", v + ": " + (versionResolver != null));
}
}
```
--------------------------------
### doRun(Class> bootClass)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Runs the main class.
```APIDOC
## doRun(Class> bootClass)
### Description
Runs the main class.
### Method
protected void doRun(java.lang.Class> bootClass)
### Parameters
- **bootClass** (Class>) - Required - The main class to run.
### Returns
void
```
--------------------------------
### createEnvWrapperFile(File)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecMojo.html
Creates a wrapper file for the environment script. Throws IOException if an I/O error occurs.
```APIDOC
## createEnvWrapperFile(File)
### Description
Creates a wrapper file for the environment script.
### Method
protected java.io.File createEnvWrapperFile(java.io.File envScript) throws java.io.IOException
### Parameters
- **envScript** (java.io.File) - Required - The environment script file.
### Returns
- **java.io.File** - The created wrapper file.
### Throws
- **java.io.IOException** - If an I/O error occurs.
```
--------------------------------
### newInstance(Class> bootClass)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Creates a new instance of the given class.
```APIDOC
## newInstance(Class> bootClass)
### Description
Creates a new instance of the given class.
### Method
protected java.lang.Object newInstance(java.lang.Class> bootClass)
### Parameters
- **bootClass** (Class>) - Required - The class to instantiate.
### Returns
Object - A new instance of the class.
```
--------------------------------
### doExecClassLoader(String bootClassName)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Executes the main class using a classloader.
```APIDOC
## doExecClassLoader(String bootClassName)
### Description
Executes the main class using a classloader.
### Method
protected void doExecClassLoader(java.lang.String bootClassName)
### Parameters
- **bootClassName** (String) - Required - The fully qualified name of the main class to execute.
### Returns
void
```
--------------------------------
### Exec Goal: Command Line with System Properties (exec:exec)
Source: https://www.mojohaus.org/exec-maven-plugin/usage.html
Use system properties to execute a command with the exec goal. The -Dexec.executable property specifies the command, -Dexec.args sets the arguments, and optional working directory via -Dexec.workingdir.
```text
mvn exec:exec -Dexec.executable="maven" [-Dexec.workingdir="/tmp"] -Dexec.args="-X myproject:dist"
```
--------------------------------
### Run Java class with exec:java from command line
Source: https://www.mojohaus.org/exec-maven-plugin/usage.html
Runs a Java class in the same VM as Maven using the exec:java goal. The -Dexec.mainClass parameter is required; -Dexec.args is optional and can be repeated.
```bash
mvn exec:java -Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ...
```
--------------------------------
### getClassLoader()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Sets up a classloader for the execution of the main class.
```APIDOC
## getClassLoader()
### Description
Sets up a classloader for the execution of the main class.
### Method
protected java.net.URLClassLoader getClassLoader()
### Parameters
None
### Returns
URLClassLoader - The classloader for the execution.
```
--------------------------------
### Set MAVEN_OPTS for java goal VM options
Source: https://www.mojohaus.org/exec-maven-plugin/usage.html
Sets a VM option for the Maven VM, which is required because the java goal does not spawn a new process. Use this to pass options like -Xmx1024m to the executed class.
```bash
MAVEN_OPTS=-Xmx1024m
```
--------------------------------
### Run Java program with exec.args and %classpath
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html
Use this command to run a Java program with the exec goal, passing the project classpath via the %classpath placeholder in exec.args. The placeholder is replaced by Maven with the computed project classpath.
```bash
mvn exec:exec -Dexec.executable="java" [...] -Dexec.args="%classpath"
```
--------------------------------
### POM configuration with for exec goal
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html
POM configuration for the exec goal that uses the special argument to automatically build the classpath from all project dependencies and the project build directory. Replace com.example.Main with your main class.
```xml
java
-classpath
com.example.Main
...
```
--------------------------------
### execute()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Executes the goal. This is the main entry point for the plugin goal execution.
```APIDOC
## execute()
### Description
Executes the goal. This is the main entry point for the plugin goal execution.
### Method
void execute()
### Parameters
None
### Returns
void
### Throws
- MojoExecutionException - if execution fails
- MojoFailureException - if execution fails
```
--------------------------------
### execute
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Executes the goal by running the main class or handling threads it generates. Throws MojoExecutionException if execution fails and MojoFailureException for other errors.
```APIDOC
## execute
### Description
Executes the goal. This method is the main entry point for the Maven goal execution.
### Method
public void execute()
### Parameters
None
### Throws
- **MojoExecutionException** - execution of the main class or one of the threads it generated failed.
- **MojoFailureException** - something bad happened...
```
--------------------------------
### createEnvs(File)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecMojo.html
Creates environment variables from a script file. Throws MojoExecutionException if the script cannot be processed.
```APIDOC
## createEnvs(File)
### Description
Creates environment variables from a script file.
### Method
protected java.util.Map createEnvs(java.io.File envScriptFile) throws org.apache.maven.plugin.MojoExecutionException
### Parameters
- **envScriptFile** (java.io.File) - Required - The script file to read environment variables from.
### Returns
- **java.util.Map** - A map of environment variables.
### Throws
- **org.apache.maven.plugin.MojoExecutionException** - If the script cannot be processed.
```
--------------------------------
### executeCommandLine(Executor, CommandLine, Map, FileOutputStream)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecMojo.html
Executes a command line using the provided executor, command line, environment variables, and output file. This method throws IOException if execution fails.
```APIDOC
## executeCommandLine(Executor, CommandLine, Map, FileOutputStream)
### Description
Executes a command line using the provided executor, command line, environment variables, and output file.
### Method
protected int executeCommandLine(org.apache.commons.exec.Executor exec, org.apache.commons.exec.CommandLine commandLine, java.util.Map enviro, java.io.FileOutputStream outputFile) throws java.io.IOException
### Parameters
- **exec** (org.apache.commons.exec.Executor) - Required - The executor to use for execution.
- **commandLine** (org.apache.commons.exec.CommandLine) - Required - The command line to execute.
- **enviro** (java.util.Map) - Required - Environment variables for the process.
- **outputFile** (java.io.FileOutputStream) - Required - The output file stream.
### Throws
- **java.io.IOException** - If an I/O error occurs during execution.
```
--------------------------------
### Browse source repository on GitHub
Source: https://www.mojohaus.org/exec-maven-plugin/scm.html
Link to the browsable version of the source repository on GitHub.
```text
https://github.com/mojohaus/exec-maven-plugin/tree/master
```
--------------------------------
### executeMainMethod(Class> bootClass)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Executes the main method of the given class.
```APIDOC
## executeMainMethod(Class> bootClass)
### Description
Executes the main method of the given class.
### Method
protected void executeMainMethod(java.lang.Class> bootClass)
### Parameters
- **bootClass** (Class>) - Required - The class containing the main method.
### Returns
void
```
--------------------------------
### doExecModulePath(String moduleName, String bootClassName)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Executes using module path (Java 9+ JPMS).
```APIDOC
## doExecModulePath(String moduleName, String bootClassName)
### Description
Executes using module path (Java 9+ JPMS).
### Method
protected abstract void doExecModulePath(java.lang.String moduleName, java.lang.String bootClassName)
### Parameters
- **moduleName** (String) - Required - The name of the module.
- **bootClassName** (String) - Required - The fully qualified name of the main class to execute.
### Returns
void
```
--------------------------------
### systemProperties parameter
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
A list of system properties to be passed. Note: as the execution is not forked, some system properties required by the JVM cannot be passed here. Use MAVEN_OPTS or exec:exec instead.
```java
@Parameter
protected AbstractProperty[] systemProperties
```
--------------------------------
### POM configuration for Java modules with
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html
POM configuration for the exec goal to run Java modules (Java 9+). Uses the special argument to automatically create the module path from project dependencies and the build directory. Replace mymodule/com.example.Main with your module and main class.
```xml
java
--module-path
--module
mymodule/com.example.Main
...
```
--------------------------------
### systemProperties
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
A list of system properties to be passed to the executed class.
```APIDOC
## systemProperties
### Description
A list of system properties to be passed. Note: as the execution is not forked, some system properties required by the JVM cannot be passed here. Use MAVEN_OPTS or the exec:exec instead. See the user guide for more information.
### Parameters
- **systemProperties** (AbstractProperty[]) - Optional - No property binding
### Since
1.0
```
--------------------------------
### Define toolchains.xml Configuration
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-toolchains.html
Defines the JDK toolchain location and versioning in the toolchains.xml file.
```xml
jdk
z.y.z
vendor
...
C:\Program Files\Java\jdk-x.y.z
...
```
--------------------------------
### Define toolchains.xml for Custom Toolchains
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-toolchains.html
Define the toolchain type, provisions, and configuration in the toolchains.xml file.
```xml
...
```
--------------------------------
### execute() - Method in class org.codehaus.mojo.exec_maven_plugin.HelpMojo
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/index-all.html
Executes the help goal. This method is part of the HelpMojo class for displaying help information.
```APIDOC
## execute() - Method in class org.codehaus.mojo.exec_maven_plugin.HelpMojo
### Description
Executes the help goal. This method is part of the HelpMojo class for displaying help information.
### Method
N/A (Java method)
### Parameters
None
### Returns
void
```
--------------------------------
### execute()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecMojo.html
Executes the external program. Priority is given to system properties arguments over the pom specification.
```APIDOC
## execute()
### Description
Executes the external program. Priority is given to system properties arguments over the pom specification.
### Method
void execute()
### Throws
- `org.apache.maven.plugin.MojoExecutionException` - if a failure happens
```
--------------------------------
### executeCommandLine(Executor, CommandLine, Map, PumpStreamHandler)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecMojo.html
Executes a command line using the provided executor, command line, environment variables, and pump stream handler. This method throws IOException if execution fails.
```APIDOC
## executeCommandLine(Executor, CommandLine, Map, PumpStreamHandler)
### Description
Executes a command line using the provided executor, command line, environment variables, and pump stream handler.
### Method
protected int executeCommandLine(org.apache.commons.exec.Executor exec, org.apache.commons.exec.CommandLine commandLine, java.util.Map enviro, org.apache.commons.exec.PumpStreamHandler psh) throws java.io.IOException
### Parameters
- **exec** (org.apache.commons.exec.Executor) - Required - The executor to use for execution.
- **commandLine** (org.apache.commons.exec.CommandLine) - Required - The command line to execute.
- **enviro** (java.util.Map) - Required - Environment variables for the process.
- **psh** (org.apache.commons.exec.PumpStreamHandler) - Required - The pump stream handler.
### Throws
- **java.io.IOException** - If an I/O error occurs during execution.
```
--------------------------------
### SystemProperty()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/SystemProperty.html
Constructor for the SystemProperty class. It is a public no-argument constructor used to instantiate a SystemProperty object.
```APIDOC
## SystemProperty()
### Description
Public constructor for the SystemProperty class. It initializes a new instance of the SystemProperty class.
### Method
Constructor
### Constructor
`public SystemProperty()`
### Parameters
None
### Returns
No return value (constructor).
### Throws
None
### Example
```java
SystemProperty prop = new SystemProperty();
```
```
--------------------------------
### Configure pom.xml for Paths Toolchain
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-toolchains.html
Enable the paths toolchain by setting true in the exec-maven-plugin configuration and defining the toolchain in the maven-toolchains-plugin.
```xml
...
maven-toolchains-plugin
3.3.0
toolchain
foo-bar
org.codehaus.mojo
exec-maven-plugin
3.6.4
true
...
paths
meExecutable
...
...
```
--------------------------------
### AbstractExecMojo constructor
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Constructor for AbstractExecMojo that accepts a RepositorySystem instance.
```java
protected AbstractExecMojo(org.eclipse.aether.RepositorySystem repositorySystem)
```
--------------------------------
### pom.xml configuration for exec-maven-plugin with projectProperties
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-java-project-properties.html
Configure the exec-maven-plugin to forward Maven properties to the main class by including in the section. Place any overrides after this element to take precedence.
```xml
...
org.codehaus.mojo
exec-maven-plugin
3.6.4
...
java
com.example.Main
argument1
...
myproperty
myvalue
...
...
```
--------------------------------
### Define toolchains.xml for Paths Toolchain
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-toolchains.html
Define the paths toolchain in toolchains.xml, specifying the directories where the plugin should search for the executable.
```xml
paths
foo-bar
C:\Program Files\FooBar\SDK\bin
C:\Program Files\FooBar\Runtime\bin
...
```
--------------------------------
### setSystemProperties()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Passes any given system properties to the Java system properties.
```APIDOC
## setSystemProperties()
### Description
Passes any given system properties to the Java system properties.
### Method
protected void setSystemProperties()
### Parameters
None
### Returns
void
```
--------------------------------
### Multi-threaded output with useMavenLogger
Source: https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html
Shows the output when the exec plugin runs multi-threaded on two modules with the useMavenLogger flag enabled. The output is prefixed with [Exec Stream Pumper] and includes thread names.
```text
...
[Exec Stream Pumper] [INFO] [BuilderThread 2] module2 - 98
[Exec Stream Pumper] [INFO] [BuilderThread 1] module1 - 97
[Exec Stream Pumper] [INFO] [BuilderThread 1] module1 - 98
[Exec Stream Pumper] [INFO] [BuilderThread 2] module2 - 99
...
```
--------------------------------
### getSession method signature
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Returns the Maven session.
```java
protected final org.apache.maven.execution.MavenSession getSession()
```
--------------------------------
### getSystemProperty(String)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecMojo.html
Retrieves a system property value by key.
```APIDOC
## getSystemProperty(String)
### Description
Retrieves a system property value by key.
### Method
protected java.lang.String getSystemProperty(java.lang.String key)
### Parameters
- **key** (java.lang.String) - Required - The system property key.
### Returns
- **java.lang.String** - The value of the system property.
```
--------------------------------
### arguments
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
The class arguments to pass to the main class.
```APIDOC
## arguments
### Description
The class arguments.
### Parameters
- **arguments** (java.lang.String[]) - Optional - Property: `exec.arguments`
### Since
1.0
```
--------------------------------
### POM configuration with restricted dependencies
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html
POM configuration for the exec goal that restricts the classpath to specific dependencies by listing them inside the element. Only the listed dependencies (e.g., commons-io and commons-lang) are included.
```xml
java
-classpath
commons-io:commons-io
commons-lang:commons-lang
com.example.Main
...
```
--------------------------------
### getSession
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Retrieves the Maven session.
```APIDOC
## getSession
### Description
Retrieves the Maven session.
### Method
protected org.apache.maven.execution.MavenSession
### Signature
`protected org.apache.maven.execution.MavenSession getSession()`
### Returns
The Maven session.
```
--------------------------------
### Multi-threaded output without useMavenLogger
Source: https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html
Shows the output when the exec plugin runs multi-threaded on two modules without the useMavenLogger flag. The output is interleaved and not thread-safe.
```text
[BuilderThread 1] [INFO] --- exec-maven-plugin:1.6.0:exec (test) @ module1 ---
[BuilderThread 2] [INFO] --- exec-maven-plugin:1.6.0:exec (test) @ module2 ---
...
module2 - 98
modu
module1 - 97
module1 -
le2 - 9899
...
```
--------------------------------
### executeCommandLine(Executor, CommandLine, Map, FileOutputStream) - Method in class org.codehaus.mojo.exec.ExecMojo
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/index-all.html
Executes a command line with the given executor, command line, environment, and output stream. This method is part of the ExecMojo class.
```APIDOC
## executeCommandLine(Executor, CommandLine, Map, FileOutputStream) - Method in class org.codehaus.mojo.exec.ExecMojo
### Description
Executes a command line with the given executor, command line, environment, and output stream. This method is part of the ExecMojo class.
### Method
N/A (Java method)
### Parameters
- **executor** (Executor) - Required - The executor to use.
- **commandLine** (CommandLine) - Required - The command line to execute.
- **env** (Map) - Required - The environment variables.
- **outputStream** (FileOutputStream) - Required - The output stream for the process output.
### Returns
void
```
--------------------------------
### toString()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecutableDependency.html
Returns a string representation of the ExecutableDependency object.
```APIDOC
## toString()
### Description
Returns a string representation of the object.
### Method Signature
`public java.lang.String toString()`
### Overrides
- `toString` in class `java.lang.Object`
```
--------------------------------
### Property()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/Property.html
Constructor for the Property class.
```APIDOC
## Property()
### Description
Constructor for the Property class.
### Method
Constructor
### Signature
public Property()
```
--------------------------------
### getPluginDependencies
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Retrieves the plugin dependencies.
```APIDOC
## getPluginDependencies
### Description
Retrieves the plugin dependencies.
### Method
protected java.util.List
### Signature
`protected java.util.List getPluginDependencies()`
### Returns
A list of plugin dependencies.
```
--------------------------------
### executeCommandLine(Executor, CommandLine, Map, OutputStream, OutputStream) - Method in class org.codehaus.mojo.exec.ExecMojo
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/index-all.html
Executes a command line with the given executor, command line, environment, and output streams. This method is part of the ExecMojo class.
```APIDOC
## executeCommandLine(Executor, CommandLine, Map, OutputStream, OutputStream) - Method in class org.codehaus.mojo.exec.ExecMojo
### Description
Executes a command line with the given executor, command line, environment, and output streams. This method is part of the ExecMojo class.
### Method
N/A (Java method)
### Parameters
- **executor** (Executor) - Required - The executor to use.
- **commandLine** (CommandLine) - Required - The command line to execute.
- **env** (Map) - Required - The environment variables.
- **outputStream** (OutputStream) - Required - The output stream for standard output.
- **errorStream** (OutputStream) - Required - The output stream for standard error.
### Returns
void
```
--------------------------------
### Configure pom.xml for JDK Toolchain
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-toolchains.html
Configures the maven-toolchains-plugin to select a JDK version and the exec-maven-plugin to use the java executable from that toolchain.
```xml
...
maven-toolchains-plugin
3.3.0
toolchain
[x,)
org.codehaus.mojo
exec-maven-plugin
3.6.4
java
...
...
```
--------------------------------
### Modulepath()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/Modulepath.html
Default constructor for the Modulepath class.
```APIDOC
## Modulepath()
### Description
Default constructor for the Modulepath class.
### Method
Constructor
### Signature
public Modulepath()
```
--------------------------------
### execute() - Method in class org.codehaus.mojo.exec.ExecMojo
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/index-all.html
Executes the goal with priority given to System properties arguments over the pom specification. This method is part of the ExecMojo class for executing external programs.
```APIDOC
## execute() - Method in class org.codehaus.mojo.exec.ExecMojo
### Description
Executes the goal with priority given to System properties arguments over the pom specification. This method is part of the ExecMojo class for executing external programs.
### Method
N/A (Java method)
### Parameters
None
### Returns
void
```
--------------------------------
### executeMainMethod
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Executes the main method. Subclasses may override to provide version-specific behavior (e.g., Module opening logic for Java 9+).
```APIDOC
## executeMainMethod
### Description
Executes the main method. Subclasses may override to provide version-specific behavior (e.g., Module opening logic for Java 9+).
### Method
protected void executeMainMethod(Class> bootClass)
### Parameters
- **bootClass** (Class>) - the class containing the main method
### Throws
- **Throwable** - if execution fails
```
--------------------------------
### preloadCommonPool()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Pre-creates common pool threads to avoid exec:java considering them leaked.
```APIDOC
## preloadCommonPool()
### Description
Pre-creates common pool threads to avoid exec:java considering them leaked.
### Method
protected void preloadCommonPool()
### Parameters
None
### Returns
void
```
--------------------------------
### getPluginDependencies method signature
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Returns the plugin dependencies as a list of Artifact objects.
```java
protected final java.util.List getPluginDependencies()
```
--------------------------------
### mainClass
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
The fully qualified name of the main class to execute. Supports module names (Java 9+) and Runnable implementations with constructor injection.
```APIDOC
## mainClass
### Description
The main class to execute. With Java 9 and above you can prefix it with the modulename, e.g. `com.greetings/com.greetings.Main`. Without modulename the classpath will be used, with modulename a new modulelayer will be created. Note that you can also provide a `Runnable` fully qualified name. The runnable can get constructor injections either by type if you have maven in your classpath (can be provided) or by name (ensure to enable `-parameters` Java compiler option) for loose coupling. Current support loose injections are:
- `systemProperties`: `Properties`, session system properties
- `systemPropertiesUpdater`: `BiConsumer`, session system properties update callback (pass the key/value to update, null value means removal of the key)
- `userProperties`: `Properties`, session user properties
- `userPropertiesUpdater`: `BiConsumer`, session user properties update callback (pass the key/value to update, null value means removal of the key)
- `projectProperties`: `Properties`, project properties
- `projectPropertiesUpdater`: `BiConsumer`, project properties update callback (pass the key/value to update, null value means removal of the key)
- `highestVersionResolver`: `Function`, passing a `groupId:artifactId` you get the latest resolved version from the project repositories
### Since
1.0
```
--------------------------------
### Configure exec-maven-plugin java goal in POM
Source: https://www.mojohaus.org/exec-maven-plugin/usage.html
Configures the exec-maven-plugin java goal in the POM. The mainClass, arguments, and systemProperties elements are optional; the version shown is 3.6.4.
```xml
...
org.codehaus.mojo
exec-maven-plugin
3.6.4
...
java
com.example.Main
argument1
...
myproperty
myvalue
...
...
```
--------------------------------
### registerSourceRoots
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Registers compile and test source roots if necessary.
```APIDOC
## registerSourceRoots
### Description
Register compile and compile tests source roots if necessary.
### Method
protected void
### Signature
`protected void registerSourceRoots()`
### Description
This method is used to add source roots to the project for compilation.
```
--------------------------------
### Configure pom.xml for Custom Toolchains
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-toolchains.html
Add the maven-toolchains-plugin and configure the exec-maven-plugin to use a specific toolchain type ID.
```xml
...
...
maven-toolchains-plugin
3.3.0
toolchain
org.codehaus.mojo
exec-maven-plugin
3.6.4
...
meExecutable
...
...
```
--------------------------------
### toString()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/Modulepath.html
Returns a string representation of the Modulepath object.
```APIDOC
## toString()
### Description
Returns a string representation of the Modulepath object.
### Method
toString
### Signature
public java.lang.String toString()
### Returns
- **String** - A string representation of the object.
```
--------------------------------
### arguments parameter
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
The class arguments to pass to the main class.
```java
@Parameter(property="exec.arguments")
protected java.lang.String[] arguments
```
--------------------------------
### Apache License 2.0 Full Text
Source: https://www.mojohaus.org/exec-maven-plugin/licenses.html
The complete legal text of the Apache License, Version 2.0, January 2004. This is the license under which the project is distributed.
```text
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
```
--------------------------------
### includeProjectDependencies parameter
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Indicates if the project dependencies should be used when executing the main class.
```java
@Parameter(property="exec.includeProjectDependencies",
defaultValue="true")
protected boolean includeProjectDependencies
```
--------------------------------
### addRelevantPluginDependenciesToClasspath(List path)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Adds any relevant plugin dependencies to the classpath.
```APIDOC
## addRelevantPluginDependenciesToClasspath(List path)
### Description
Adds any relevant plugin dependencies to the classpath.
### Method
protected void addRelevantPluginDependenciesToClasspath(java.util.List path)
### Parameters
- **path** (List) - Required - The list of classpath entries to which plugin dependencies are added.
### Returns
void
```
--------------------------------
### hashCode()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecutableDependency.html
Returns a hash code value for the ExecutableDependency object.
```APIDOC
## hashCode()
### Description
Returns a hash code value for the object.
### Method Signature
`public int hashCode()`
### Overrides
- `hashCode` in class `java.lang.Object`
```
--------------------------------
### doExecClassLoader
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Executes the main class using a classloader-based approach. This is a protected method that subclasses can use.
```APIDOC
## doExecClassLoader
### Description
Executes the main class using a classloader-based approach.
### Method
protected void doExecClassLoader(String bootClassName)
### Parameters
- **bootClassName** (String) - the fully qualified class name of the main class
### Throws
- **Throwable** - if execution fails
```
--------------------------------
### equals(Object o)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/ExecutableDependency.html
Compares this ExecutableDependency with another object for equality.
```APIDOC
## equals(Object o)
### Description
Indicates whether some other object is equal to this one.
### Method Signature
`public boolean equals(java.lang.Object o)`
### Parameters
- `o` (java.lang.Object) - the reference object with which to compare.
### Overrides
- `equals` in class `java.lang.Object`
```
--------------------------------
### determineRelevantPluginDependencies() - Method in class org.codehaus.mojo.exec.AbstractExecMojo
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/index-all.html
Determines all plugin dependencies relevant to the executable. This method is part of the AbstractExecMojo class.
```APIDOC
## determineRelevantPluginDependencies() - Method in class org.codehaus.mojo.exec.AbstractExecMojo
### Description
Determines all plugin dependencies relevant to the executable. This method is part of the AbstractExecMojo class.
### Method
N/A (Java method)
### Parameters
None
### Returns
List of plugin dependencies (type not specified)
```
--------------------------------
### Set classpathScope to test in exec plugin
Source: https://www.mojohaus.org/exec-maven-plugin/examples/example-exec-or-java-change-classpath-scope.html
Configure the classpath scope for the exec plugin. The first block shows the XML configuration element for a test scope, and the second shows the equivalent command-line property.
```xml
...
test
...
```
```bash
mvn exec:java [...] -Dexec.classpathScope="test"
```
--------------------------------
### includeProjectDependencies
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Indicates if the project dependencies should be used when executing the main class.
```APIDOC
## includeProjectDependencies
### Description
Indicates if the project dependencies should be used when executing the main class.
### Parameters
- **includeProjectDependencies** (boolean) - Optional - Default: `true` - Property: `exec.includeProjectDependencies`
### Since
1.1-beta-1
```
--------------------------------
### Configure exec-maven-plugin in POM
Source: https://www.mojohaus.org/exec-maven-plugin/plugin-info.html
Specify the exec-maven-plugin version in the project's plugin configuration. The pluginManagement section defines the version, while the plugins section enables the plugin goals in the POM or parent POM.
```xml
...
org.codehaus.mojo
exec-maven-plugin
3.6.4
...
org.codehaus.mojo
exec-maven-plugin
...
...
```
--------------------------------
### isSkip
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Checks if the execution should be skipped.
```APIDOC
## isSkip
### Description
Check if the execution should be skipped.
### Method
protected boolean
### Signature
`protected boolean isSkip()`
### Returns
True if the execution should be skipped, false otherwise.
```
--------------------------------
### getKey()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/Property.html
Getter for the field key. Returns the key as a String.
```APIDOC
## getKey()
### Description
Getter for the field key.
### Method
public java.lang.String getKey()
### Returns
- **java.lang.String** - a String object.
```
--------------------------------
### lookup(Parameter param, String name)
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecJavaBase.html
Looks up a value for a parameter.
```APIDOC
## lookup(Parameter param, String name)
### Description
Looks up a value for a parameter.
### Method
protected java.lang.Object lookup(java.lang.reflect.Parameter param, java.lang.String name)
### Parameters
- **param** (Parameter) - Required - The parameter to look up.
- **name** (String) - Required - The name of the parameter.
### Returns
Object - The value of the parameter.
```
--------------------------------
### Exec Goal: POM Configuration for exec-maven-plugin
Source: https://www.mojohaus.org/exec-maven-plugin/usage.html
Add this Maven POM configuration to use the exec goal with the exec-maven-plugin version 3.6.4. The configuration specifies the executable, optional working directory, arguments, and environment variables.
```xml
...
org.codehaus.mojo
exec-maven-plugin
3.6.4
...
exec
maven
/tmp
-X
myproject:dist
...
en_US
...
```
--------------------------------
### parseCommandlineArgs
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/AbstractExecMojo.html
Parses the argument string given by the user.
```APIDOC
## parseCommandlineArgs
### Description
Parses the argument string given by the user.
### Method
protected java.lang.String[]
### Signature
`protected java.lang.String[] parseCommandlineArgs()`
### Returns
An array of parsed command-line arguments.
```
--------------------------------
### getDependencies()
Source: https://www.mojohaus.org/exec-maven-plugin/apidocs/org/codehaus/mojo/exec/Modulepath.html
Returns the collection of module dependencies.
```APIDOC
## getDependencies()
### Description
Returns the collection of module dependencies.
### Method
getDependencies
### Signature
public java.util.Collection getDependencies()
### Returns
- **Collection** - The collection of dependencies.
```