API Documentation: | JavaExec |
---|
Executes a Java application in a child process.
The process can be started in debug mode (see JavaExec.getDebug()
) in an ad-hoc manner by supplying the `--debug-jvm` switch when invoking the build.
gradle someJavaExecTask --debug-jvm
Property | Description |
allJvmArgs | The full set of arguments to use to launch the JVM for the process. This includes arguments to define system properties, the minimum/maximum heap size, and the bootstrap classpath. |
args | The arguments passed to the main class to be executed. |
bootstrapClasspath | The bootstrap classpath to use for the process. The default bootstrap classpath for the JVM is used when this classpath is empty. |
classpath | The classpath for executing the main class. |
commandLine | The full command line, including the executable plus its arguments. |
debug | Returns true if debugging is enabled for the process. When enabled, the process is started suspended and listening on port 5005. |
enableAssertions | Returns true if assertions are enabled for the process. |
environment | The environment variables to use for the process. Defaults to the environment of this process. |
errorOutput | The output stream to consume standard error from the process executing the command. Default to |
executable | The name of the executable to use. |
ignoreExitValue | Tells whether a non-zero exit value is ignored, or an exception thrown. Defaults to |
jvmArgs | The extra arguments to use to launch the JVM for the process. Does not include system properties and the minimum/maximum heap size. |
main | The fully qualified name of the Main class to be executed. |
maxHeapSize | The maximum heap size for the process, if any. |
standardInput | The standard input stream for the process executing the command. The stream is closed after the process completes. Defaults to an empty stream. |
standardOutput | The output stream to consume standard output from the process executing the command. Defaults to |
systemProperties | The system properties which will be used for the process. |
workingDir | The working directory for the process. Defaults to the project directory. |
Method | Description |
args(args) | Adds args for the main class to be executed. |
args(args) | Adds args for the main class to be executed. |
bootstrapClasspath(classpath) | Adds the given values to the end of the bootstrap classpath for the process. |
classpath(paths) | Adds elements to the classpath for executing the main class. |
copyTo(options) | Copies these options to the given options. |
copyTo(target) | Copies these options to the given target options. |
environment(name, value) | Adds an environment variable to the environment for this process. |
environment(environmentVariables) | Adds some environment variables to the environment for this process. |
executable(executable) | Sets the name of the executable to use. |
jvmArgs(arguments) | Adds some arguments to use to launch the JVM for the process. |
jvmArgs(arguments) | Adds some arguments to use to launch the JVM for the process. |
systemProperties(properties) | Adds some system properties to use for the process. |
workingDir(dir) | Sets the working directory for the process. The supplied argument is evaluated as per |
The full set of arguments to use to launch the JVM for the process. This includes arguments to define system properties, the minimum/maximum heap size, and the bootstrap classpath.
FileCollection
bootstrapClasspath
The bootstrap classpath to use for the process. The default bootstrap classpath for the JVM is used when this classpath is empty.
- Default:
[]
The full command line, including the executable plus its arguments.
Returns true if debugging is enabled for the process. When enabled, the process is started suspended and listening on port 5005.
- Default:
false
The environment variables to use for the process. Defaults to the environment of this process.
- Default:
- Current process' environment
OutputStream
errorOutput
The output stream to consume standard error from the process executing the command. Default to System.err
.
- Default:
System.err
Tells whether a non-zero exit value is ignored, or an exception thrown. Defaults to false
.
- Default:
false
The extra arguments to use to launch the JVM for the process. Does not include system properties and the minimum/maximum heap size.
- Default:
[]
InputStream
standardInput
The standard input stream for the process executing the command. The stream is closed after the process completes. Defaults to an empty stream.
- Default:
- An empty
InputStream
OutputStream
standardOutput
The output stream to consume standard output from the process executing the command. Defaults to System.out
.
- Default:
System.out
The system properties which will be used for the process.
- Default:
[:]
File
workingDir
The working directory for the process. Defaults to the project directory.
- Default:
project.projectDir
JavaExecSpec
args
(Iterable
<?>
args)
Iterable
<?>Adds args for the main class to be executed.
Adds the given values to the end of the bootstrap classpath for the process.
JavaExec
copyTo
(JavaForkOptions
options)
Copies these options to the given options.
JavaExec
copyTo
(ProcessForkOptions
target)
Copies these options to the given target options.
Adds an environment variable to the environment for this process.
Adds some environment variables to the environment for this process.
Adds some arguments to use to launch the JVM for the process.
Adds some system properties to use for the process.
Sets the working directory for the process. The supplied argument is evaluated as per Project.file()
.