T - The concrete type of the class.Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, BaseExecSpec, ExecSpec, ProcessForkOptions, Configurable<Task>Exec, RunTestExecutable@DisableCachingByDefault(because="Abstract super-class, not to be instantiated directly") public abstract class AbstractExecTask<T extends AbstractExecTask> extends org.gradle.api.internal.ConventionTask implements ExecSpec
AbstractExecTask is the base class for all exec tasks.Task.NamerTASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE| Constructor | Description |
|---|---|
AbstractExecTask(Class<T> taskType) |
| Modifier and Type | Method | Description |
|---|---|---|
T |
args(Iterable<?> args) |
Adds arguments for the command to be executed.
|
T |
args(Object... args) |
Adds arguments for the command to be executed.
|
T |
commandLine(Iterable<?> args) |
Sets the full command line, including the executable to be executed plus its arguments.
|
T |
commandLine(Object... arguments) |
Sets the full command line, including the executable to be executed plus its arguments.
|
T |
copyTo(ProcessForkOptions target) |
Copies these options to the given target options.
|
T |
environment(String name,
Object value) |
Adds an environment variable to the environment for this process.
|
T |
environment(Map<String,?> environmentVariables) |
Adds some environment variables to the environment for this process.
|
protected void |
exec() |
|
T |
executable(Object executable) |
Sets the name of the executable to use.
|
List<String> |
getArgs() |
Returns the arguments for the command to be executed.
|
List<CommandLineArgumentProvider> |
getArgumentProviders() |
Argument providers for the application.
|
List<String> |
getCommandLine() |
Returns the full command line, including the executable plus its arguments.
|
Map<String,Object> |
getEnvironment() |
The environment variables to use for the process.
|
OutputStream |
getErrorOutput() |
Returns the output stream to consume standard error from the process executing the command.
|
protected org.gradle.process.internal.ExecActionFactory |
getExecActionFactory() |
|
ExecResult |
getExecResult() |
Deprecated.
Use
getExecutionResult() instead. |
String |
getExecutable() |
Returns the name of the executable to use.
|
Provider<ExecResult> |
getExecutionResult() |
Returns the result for the command run by this task.
|
protected ObjectFactory |
getObjectFactory() |
|
InputStream |
getStandardInput() |
Returns the standard input stream for the process executing the command.
|
OutputStream |
getStandardOutput() |
Returns the output stream to consume standard output from the process executing the command.
|
File |
getWorkingDir() |
Returns the working directory for the process.
|
boolean |
isIgnoreExitValue() |
Tells whether a non-zero exit value is ignored, or an exception thrown.
|
T |
setArgs(Iterable<?> arguments) |
Sets the arguments for the command to be executed.
|
T |
setArgs(List<String> arguments) |
Sets the arguments for the command to be executed.
|
void |
setCommandLine(Iterable<?> args) |
Sets the full command line, including the executable to be executed plus its arguments.
|
void |
setCommandLine(Object... args) |
Sets the full command line, including the executable to be executed plus its arguments.
|
void |
setCommandLine(List<String> args) |
Sets the full command line, including the executable to be executed plus its arguments.
|
void |
setEnvironment(Map<String,?> environmentVariables) |
Sets the environment variable to use for the process.
|
T |
setErrorOutput(OutputStream outputStream) |
Sets the output stream to consume standard error from the process executing the command.
|
void |
setExecutable(Object executable) |
Sets the name of the executable to use.
|
void |
setExecutable(String executable) |
Sets the name of the executable to use.
|
T |
setIgnoreExitValue(boolean ignoreExitValue) |
Sets whether a non-zero exit value is ignored, or an exception thrown.
|
T |
setStandardInput(InputStream inputStream) |
Sets the standard input stream for the process executing the command.
|
T |
setStandardOutput(OutputStream outputStream) |
Sets the output stream to consume standard output from the process executing the command.
|
void |
setWorkingDir(File dir) |
Sets the working directory for the process.
|
void |
setWorkingDir(Object dir) |
Sets the working directory for the process.
|
T |
workingDir(Object dir) |
Sets the working directory for the process.
|
conventionMapping, conventionMapping, getConventionMappingcompareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceappendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getOnlyIf, getReasonNotToTrackState, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, prependParallelSafeAction, setImpliesSubProjectsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdoNotTrackState, getConvention@Inject protected ObjectFactory getObjectFactory()
@Inject protected org.gradle.process.internal.ExecActionFactory getExecActionFactory()
protected void exec()
public T commandLine(Object... arguments)
commandLine in interface ExecSpecarguments - the command plus the args to be executedpublic T commandLine(Iterable<?> args)
commandLine in interface ExecSpecargs - the command plus the args to be executedpublic T setArgs(List<String> arguments)
public T setArgs(@Nullable Iterable<?> arguments)
@Nullable @Optional @Input public List<String> getArgs()
public List<CommandLineArgumentProvider> getArgumentProviders()
getArgumentProviders in interface ExecSpec@Internal public List<String> getCommandLine()
getCommandLine in interface BaseExecSpecpublic void setCommandLine(List<String> args)
setCommandLine in interface ExecSpecargs - the command plus the args to be executedpublic void setCommandLine(Iterable<?> args)
setCommandLine in interface ExecSpecargs - the command plus the args to be executedpublic void setCommandLine(Object... args)
setCommandLine in interface ExecSpecargs - the command plus the args to be executed@Nullable @Optional @Input public String getExecutable()
getExecutable in interface ProcessForkOptionspublic void setExecutable(@Nullable String executable)
setExecutable in interface ProcessForkOptionsexecutable - The executable. Must not be null.public void setExecutable(Object executable)
setExecutable in interface ProcessForkOptionsexecutable - The executable. Must not be null.public T executable(Object executable)
executable in interface ProcessForkOptionsexecutable - The executable. Must not be null.@Internal public File getWorkingDir()
getWorkingDir in interface ProcessForkOptionspublic void setWorkingDir(File dir)
setWorkingDir in interface ProcessForkOptionsdir - The working directory. Must not be null.public void setWorkingDir(Object dir)
Project.file(Object).setWorkingDir in interface ProcessForkOptionsdir - The working directory. Must not be null.public T workingDir(Object dir)
Project.file(Object).workingDir in interface ProcessForkOptionsdir - The working directory. Must not be null.@Internal public Map<String,Object> getEnvironment()
getEnvironment in interface ProcessForkOptionspublic void setEnvironment(Map<String,?> environmentVariables)
setEnvironment in interface ProcessForkOptionsenvironmentVariables - The environment variables. Must not be null.public T environment(String name, Object value)
environment in interface ProcessForkOptionsname - The name of the variable.value - The value for the variable. Must not be null.public T environment(Map<String,?> environmentVariables)
environment in interface ProcessForkOptionsenvironmentVariables - The environment variables. Must not be null.public T copyTo(ProcessForkOptions target)
copyTo in interface ProcessForkOptionstarget - The target optionspublic T setStandardInput(InputStream inputStream)
setStandardInput in interface BaseExecSpecinputStream - The standard input stream for the process. Must not be null.@Internal public InputStream getStandardInput()
getStandardInput in interface BaseExecSpecpublic T setStandardOutput(OutputStream outputStream)
setStandardOutput in interface BaseExecSpecoutputStream - The standard output stream for the process. Must not be null.@Internal public OutputStream getStandardOutput()
System.out.getStandardOutput in interface BaseExecSpecpublic T setErrorOutput(OutputStream outputStream)
setErrorOutput in interface BaseExecSpecoutputStream - The standard output error stream for the process. Must not be null.@Internal public OutputStream getErrorOutput()
System.err.getErrorOutput in interface BaseExecSpecpublic T setIgnoreExitValue(boolean ignoreExitValue)
setIgnoreExitValue in interface BaseExecSpecignoreExitValue - whether a non-zero exit value is ignored, or an exception thrown@Input public boolean isIgnoreExitValue()
false.isIgnoreExitValue in interface BaseExecSpec@Deprecated @ReplacedBy("executionResult") @Nullable public ExecResult getExecResult()
getExecutionResult() instead. This method will be removed in Gradle 8.0.null if this task has not been executed yet.null if this task has not been executed yet.for the preferred way of accessing this property.@Internal public Provider<ExecResult> getExecutionResult()