Class Exec

  • All Implemented Interfaces:
    java.lang.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', '/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()