api / org.gradle.api.tasks / Exec

Exec

open class Exec : AbstractExecTask<AbstractExecTask<*>>

Executes a command line process. Example:

 task stopTomcat(type:Exec) { workingDir '../tomcat/bin' //on windows: commandLine 'cmd', '/c', 'stop.bat' //on linux commandLine './stop.sh' //store the output instead of printing to the console: standardOutput = new ByteArrayOutputStream() //extension method stopTomcat.output() can be used to obtain the output: ext.output = { return standardOutput.toString() } } 

Constructors

<init>

Exec()

Inherited Functions

args

open fun args(vararg args: Any): T
open fun args(args: MutableIterable<*>): T

{@inheritDoc}

commandLine

open fun commandLine(vararg arguments: Any): T
open fun commandLine(args: MutableIterable<*>): T

{@inheritDoc}

copyTo

open fun copyTo(target: ProcessForkOptions): T

{@inheritDoc}

environment

open fun environment(name: String, value: Any): T
open fun environment(environmentVariables: MutableMap<String, *>): T

{@inheritDoc}

executable

open fun executable(executable: Any): T

{@inheritDoc}

getArgs

open fun getArgs(): MutableList<String>

{@inheritDoc}

getArgumentProviders

open fun getArgumentProviders(): MutableList<CommandLineArgumentProvider>

{@inheritDoc}

getCommandLine

open fun getCommandLine(): MutableList<String>

{@inheritDoc}

getEnvironment

open fun getEnvironment(): MutableMap<String, Any>

{@inheritDoc}

getErrorOutput

open fun getErrorOutput(): OutputStream

{@inheritDoc}

getExecResult

open fun getExecResult(): ExecResult

Returns the result for the command run by this task. Returns null if this task has not been executed yet.

getExecutable

open fun getExecutable(): String

{@inheritDoc}

getStandardInput

open fun getStandardInput(): InputStream

{@inheritDoc}

getStandardOutput

open fun getStandardOutput(): OutputStream

{@inheritDoc}

getWorkingDir

open fun getWorkingDir(): File

{@inheritDoc}

isIgnoreExitValue

open fun isIgnoreExitValue(): Boolean

{@inheritDoc}

setArgs

open fun setArgs(arguments: MutableList<String>): T
open fun setArgs(arguments: MutableIterable<*>): T

{@inheritDoc}

setCommandLine

open fun setCommandLine(args: MutableList<String>): Unit
open fun setCommandLine(args: MutableIterable<*>): Unit
open fun setCommandLine(vararg args: Any): Unit

{@inheritDoc}

setEnvironment

open fun setEnvironment(environmentVariables: MutableMap<String, *>): Unit

{@inheritDoc}

setErrorOutput

open fun setErrorOutput(outputStream: OutputStream): T

{@inheritDoc}

setExecutable

open fun setExecutable(executable: String): Unit
open fun setExecutable(executable: Any): Unit

{@inheritDoc}

setIgnoreExitValue

open fun setIgnoreExitValue(ignoreExitValue: Boolean): T

{@inheritDoc}

setStandardInput

open fun setStandardInput(inputStream: InputStream): T

{@inheritDoc}

setStandardOutput

open fun setStandardOutput(outputStream: OutputStream): T

{@inheritDoc}

setWorkingDir

open fun setWorkingDir(dir: File): Unit
open fun setWorkingDir(dir: Any): Unit

{@inheritDoc}

workingDir

open fun workingDir(dir: Any): T

{@inheritDoc}