Class Exec

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.AbstractExecTask<Exec>
org.gradle.api.tasks.Exec
All Implemented Interfaces:
Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, Named, ExtensionAware, Task, BaseExecSpec, ExecSpec, ProcessForkOptions, Configurable<Task>

@DisableCachingByDefault(because="Gradle would require more information to cache this task") public abstract class Exec extends AbstractExecTask<Exec>
Executes a command line process. Example:
 task stopTomcat(type:Exec) {
   workingDir '../tomcat/bin'

   //on windows:
   commandLine 'cmd.exe', '/d', '/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()
   }
 }