Groovy Documentation

org.gradle.api.tasks
[Java] Class Exec

java.lang.Object
  org.gradle.api.internal.ConventionTask
      org.gradle.api.tasks.Exec
All Implemented Interfaces:
ExecSpec

public class Exec
extends ConventionTask

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()
   }
 }
 


Constructor Summary
Exec()

 
Method Summary
Exec args(Object... args)

{@inheritDoc}

ExecSpec args(Iterable args)

{@inheritDoc}

Exec commandLine(Object... arguments)

{@inheritDoc}

ExecSpec commandLine(Iterable args)

{@inheritDoc}

Exec copyTo(ProcessForkOptions target)

{@inheritDoc}

Exec environment(String name, Object value)

{@inheritDoc}

Exec environment(Map environmentVariables)

{@inheritDoc}

Exec executable(Object executable)

{@inheritDoc}

List getArgs()

{@inheritDoc}

List getCommandLine()

{@inheritDoc}

Map getEnvironment()

{@inheritDoc}

OutputStream getErrorOutput()

{@inheritDoc}

ExecResult getExecResult()

Returns the result for the command run by this task.

String getExecutable()

{@inheritDoc}

InputStream getStandardInput()

{@inheritDoc}

OutputStream getStandardOutput()

{@inheritDoc}

File getWorkingDir()

{@inheritDoc}

boolean isIgnoreExitValue()

{@inheritDoc}

Exec setArgs(Iterable arguments)

{@inheritDoc}

void setCommandLine(Iterable args)

{@inheritDoc}

void setCommandLine(Object... args)

{@inheritDoc}

void setEnvironment(Map environmentVariables)

{@inheritDoc}

Exec setErrorOutput(OutputStream outputStream)

{@inheritDoc}

void setExecutable(Object executable)

{@inheritDoc}

ExecSpec setIgnoreExitValue(boolean ignoreExitValue)

{@inheritDoc}

Exec setStandardInput(InputStream inputStream)

{@inheritDoc}

Exec setStandardOutput(OutputStream outputStream)

{@inheritDoc}

void setWorkingDir(Object dir)

{@inheritDoc}

Exec workingDir(Object dir)

{@inheritDoc}

 

Constructor Detail

Exec

public Exec()


 
Method Detail

args

public Exec args(Object... args)
{@inheritDoc}


args

public ExecSpec args(Iterable args)
{@inheritDoc}


commandLine

public Exec commandLine(Object... arguments)
{@inheritDoc}


commandLine

public ExecSpec commandLine(Iterable args)
{@inheritDoc}


copyTo

public Exec copyTo(ProcessForkOptions target)
{@inheritDoc}


environment

public Exec environment(String name, Object value)
{@inheritDoc}


environment

public Exec environment(Map environmentVariables)
{@inheritDoc}


executable

public Exec executable(Object executable)
{@inheritDoc}


getArgs

public List getArgs()
{@inheritDoc}


getCommandLine

public List getCommandLine()
{@inheritDoc}


getEnvironment

public Map getEnvironment()
{@inheritDoc}


getErrorOutput

public OutputStream getErrorOutput()
{@inheritDoc}


getExecResult

public ExecResult getExecResult()
Returns the result for the command run by this task. Returns null if this task has not been executed yet.
Returns:
The result. Returns null if this task has not been executed yet.


getExecutable

public String getExecutable()
{@inheritDoc}


getStandardInput

public InputStream getStandardInput()
{@inheritDoc}


getStandardOutput

public OutputStream getStandardOutput()
{@inheritDoc}


getWorkingDir

public File getWorkingDir()
{@inheritDoc}


isIgnoreExitValue

public boolean isIgnoreExitValue()
{@inheritDoc}


setArgs

public Exec setArgs(Iterable arguments)
{@inheritDoc}


setCommandLine

public void setCommandLine(Iterable args)
{@inheritDoc}


setCommandLine

public void setCommandLine(Object... args)
{@inheritDoc}


setEnvironment

public void setEnvironment(Map environmentVariables)
{@inheritDoc}


setErrorOutput

public Exec setErrorOutput(OutputStream outputStream)
{@inheritDoc}


setExecutable

public void setExecutable(Object executable)
{@inheritDoc}


setIgnoreExitValue

public ExecSpec setIgnoreExitValue(boolean ignoreExitValue)
{@inheritDoc}


setStandardInput

public Exec setStandardInput(InputStream inputStream)
{@inheritDoc}


setStandardOutput

public Exec setStandardOutput(OutputStream outputStream)
{@inheritDoc}


setWorkingDir

public void setWorkingDir(Object dir)
{@inheritDoc}


workingDir

public Exec workingDir(Object dir)
{@inheritDoc}


 

Gradle API 1.12