ProcessForkOptions
JavaExecSpec
JavaExec
, RhinoShellExec
, Test
public interface JavaForkOptions extends ProcessForkOptions
Specifies the options to use to fork a Java process.
Modifier and Type | Method | Description |
---|---|---|
JavaForkOptions |
bootstrapClasspath(Object... classpath) |
Adds the given values to the end of the bootstrap classpath for the process.
|
JavaForkOptions |
copyTo(JavaForkOptions options) |
Copies these options to the given options.
|
void |
debugOptions(Action<JavaDebugOptions> action) |
Configures Java Debug Wire Protocol properties for the process.
|
List<String> |
getAllJvmArgs() |
Returns the full set of arguments to use to launch the JVM for the process.
|
FileCollection |
getBootstrapClasspath() |
Returns the bootstrap classpath to use for the process.
|
boolean |
getDebug() |
Determines whether debugging is enabled for the test process.
|
JavaDebugOptions |
getDebugOptions() |
Returns the Java Debug Wire Protocol properties for the process.
|
String |
getDefaultCharacterEncoding() |
Returns the default character encoding to use.
|
boolean |
getEnableAssertions() |
Returns true if assertions are enabled for the process.
|
List<String> |
getJvmArgs() |
Returns the extra arguments to use to launch the JVM for the process.
|
List<CommandLineArgumentProvider> |
getJvmArgumentProviders() |
Command line argument providers for the java process to fork.
|
String |
getMaxHeapSize() |
Returns the maximum heap size for the process, if any.
|
String |
getMinHeapSize() |
Returns the minimum heap size for the process, if any.
|
Map<String,Object> |
getSystemProperties() |
Returns the system properties which will be used for the process.
|
JavaForkOptions |
jvmArgs(Iterable<?> arguments) |
Adds some arguments to use to launch the JVM for the process.
|
JavaForkOptions |
jvmArgs(Object... arguments) |
Adds some arguments to use to launch the JVM for the process.
|
void |
setAllJvmArgs(Iterable<?> arguments) |
Sets the full set of arguments to use to launch the JVM for the process.
|
void |
setAllJvmArgs(List<String> arguments) |
Sets the full set of arguments to use to launch the JVM for the process.
|
void |
setBootstrapClasspath(FileCollection classpath) |
Sets the bootstrap classpath to use for the process.
|
void |
setDebug(boolean enabled) |
Enable or disable debugging for the process.
|
void |
setDefaultCharacterEncoding(String defaultCharacterEncoding) |
Sets the default character encoding to use.
|
void |
setEnableAssertions(boolean enabled) |
Enable or disable assertions for the process.
|
void |
setJvmArgs(Iterable<?> arguments) |
Sets the extra arguments to use to launch the JVM for the process.
|
void |
setJvmArgs(List<String> arguments) |
Sets the extra arguments to use to launch the JVM for the process.
|
void |
setMaxHeapSize(String heapSize) |
Sets the maximum heap size for the process.
|
void |
setMinHeapSize(String heapSize) |
Sets the minimum heap size for the process.
|
void |
setSystemProperties(Map<String,?> properties) |
Sets the system properties to use for the process.
|
JavaForkOptions |
systemProperties(Map<String,?> properties) |
Adds some system properties to use for the process.
|
JavaForkOptions |
systemProperty(String name,
Object value) |
Adds a system property to use for the process.
|
copyTo, environment, environment, executable, getEnvironment, getExecutable, getWorkingDir, setEnvironment, setExecutable, setExecutable, setWorkingDir, setWorkingDir, workingDir
@Input Map<String,Object> getSystemProperties()
void setSystemProperties(Map<String,?> properties)
properties
- The system properties. Must not be null.JavaForkOptions systemProperties(Map<String,?> properties)
properties
- The system properties. Must not be null.JavaForkOptions systemProperty(String name, Object value)
name
- The name of the propertyvalue
- The value for the property. May be null.@Nullable @Optional @Input String getDefaultCharacterEncoding()
default character encoding of this JVM
should be used.void setDefaultCharacterEncoding(@Nullable String defaultCharacterEncoding)
file.encoding
property). For JVMs
where this is the case, setting the file.encoding
property via setSystemProperties(java.util.Map)
or similar will have no effect as
this value will be overridden by the value specified by getDefaultCharacterEncoding()
.defaultCharacterEncoding
- The default character encoding. Use null to use this JVM's default charset
@Nullable @Optional @Input String getMinHeapSize()
void setMinHeapSize(@Nullable String heapSize)
heapSize
- The minimum heap size. Use null for the default minimum heap size.@Nullable @Optional @Input String getMaxHeapSize()
void setMaxHeapSize(@Nullable String heapSize)
heapSize
- The heap size. Use null for the default maximum heap size.@Nullable @Optional @Input List<String> getJvmArgs()
void setJvmArgs(@Nullable List<String> arguments)
arguments
- The arguments. Must not be null.void setJvmArgs(@Nullable Iterable<?> arguments)
arguments
- The arguments. Must not be null.JavaForkOptions jvmArgs(Iterable<?> arguments)
arguments
- The arguments. Must not be null.JavaForkOptions jvmArgs(Object... arguments)
arguments
- The arguments.List<CommandLineArgumentProvider> getJvmArgumentProviders()
@Classpath FileCollection getBootstrapClasspath()
void setBootstrapClasspath(FileCollection classpath)
classpath
- The classpath. Must not be null. Can be empty.JavaForkOptions bootstrapClasspath(Object... classpath)
classpath
- The classpath.@Input boolean getEnableAssertions()
void setEnableAssertions(boolean enabled)
enabled
- true to enable assertions, false to disable.@Input boolean getDebug()
debug = true
— the process
is started in a suspended state, listening on port 5005. You should disable parallel test execution when
debugging and you will need to reattach the debugger occasionally if you use a non-zero value for
Test.getForkEvery()
.
Since Gradle 5.6, you can configure the port and other Java debug properties via
debugOptions(Action)
.
void setDebug(boolean enabled)
The debug properties (e.g. the port number) can be configured in debugOptions(Action)
.
enabled
- true to enable debugging, false to disable.@Incubating JavaDebugOptions getDebugOptions()
-agentlib:jdwp=...
will be appended to the JVM arguments with the configuration from the parameter.@Incubating void debugOptions(Action<JavaDebugOptions> action)
setDebug(boolean)
is enabled then
the -agentlib:jdwp=...
will be appended to the JVM arguments with the configuration from the parameter.action
- the Java debug configuration@Internal List<String> getAllJvmArgs()
void setAllJvmArgs(List<String> arguments)
arguments
- The arguments. Must not be null.void setAllJvmArgs(Iterable<?> arguments)
arguments
- The arguments. Must not be null.JavaForkOptions copyTo(JavaForkOptions options)
options
- The target options.