Class Exec

  • All Implemented Interfaces:
    Comparable, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, BaseExecSpec, ExecSpec, ProcessForkOptions, org.gradle.util.Configurable

    public class Exec
    extends 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()
       }
     }
     
    • Constructor Detail

      • Exec

        public Exec()