allprojects { }
artifacts { }
buildscript { }
configurations { }
dependencies { }
repositories { }
sourceSets { }
subprojects { }
publishing { }
Project
Task
Gradle
Settings
Script
SourceSet
SourceSetOutput
IncrementalTaskInputs
Configuration
ResolutionStrategy
ConventionProperty
ExtensionAware
ExtraPropertiesExtension
PublishingExtension
IvyPublication
IvyArtifact
IvyArtifactSet
IvyModuleDescriptor
MavenPublication
MavenArtifact
MavenArtifactSet
MavenPom
ConfigurationContainer
RepositoryHandler
DependencyHandler
ArtifactHandler
TaskReportTask
ProjectReportTask
DependencyReportTask
DependencyInsightReportTask
PropertyReportTask
AntlrTask
Checkstyle
CodeNarc
CompareGradleBuilds
Copy
CreateStartScripts
Delete
Directory
Ear
Exec
FindBugs
GenerateIvyDescriptor
GenerateMavenPom
GenerateBuildDashboard
GradleBuild
GroovyCompile
Groovydoc
JacocoReport
JacocoMerge
Jar
JavaCompile
Javadoc
JavaExec
JDepend
JettyRun
JettyRunWar
JettyStop
Pmd
PublishToIvyRepository
PublishToMavenRepository
ScalaCompile
ScalaDoc
Sign
SonarAnalyze
Sync
Tar
Test
TestReport
Upload
War
Wrapper
Zip
EclipseModel
EclipseProject
EclipseClasspath
EclipseJdt
EclipseWtp
EclipseWtpComponent
EclipseWtpFacet
IdeaModel
IdeaProject
IdeaModule
IdeaWorkspace
XmlFileContentMerger
FileContentMerger
GenerateEclipseProject
GenerateEclipseClasspath
GenerateEclipseJdt
GenerateEclipseWtpComponent
GenerateEclipseWtpFacet
GenerateIdeaModule
GenerateIdeaProject
GenerateIdeaWorkspace
API Documentation: | 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() }}
Property | Description |
args | The arguments for the command to be executed. Defaults to an empty list. |
commandLine | The full command line, including the executable plus its arguments. |
environment | The environment variables to use for the process. Defaults to the environment of this process. |
errorOutput | The output stream to consume standard error from the process executing the command. Default to |
execResult | The result for the command run by this task. Returns |
executable | The name of the executable to use. |
ignoreExitValue | Tells whether a non-zero exit value is ignored, or an exception thrown. Defaults to |
standardInput | The standard input stream for the process executing the command. The stream is closed after the processcompletes. Defaults to an empty stream. |
standardOutput | The output stream to consume standard output from the process executing the command. Defaults to |
workingDir | The working directory for the process. Defaults to the project directory. |
The environment variables to use for the process. Defaults to the environment of this process.
OutputStream
errorOutput
The output stream to consume standard error from the process executing the command. Default toSystem.err
.
ExecResult
execResult
(read-only)The result for the command run by this task. Returnsnull
if this task has not been executed yet.
String
executable
The name of the executable to use.
Tells whether a non-zero exit value is ignored, or an exception thrown. Defaults tofalse
.
InputStream
standardInput
The standard input stream for the process executing the command. The stream is closed after the processcompletes. Defaults to an empty stream.
OutputStream
standardOutput
The output stream to consume standard output from the process executing the command. Defaults toSystem.out
.
File
workingDir
The working directory for the process. Defaults to the project directory.
Method | Description |
args(args) | Adds arguments for the command to be executed. |
args(args) | Adds arguments for the command to be executed. |
commandLine(args) | Sets the full command line, including the executable to be executed plus its arguments. |
commandLine(arguments) | Sets the full command line, including the executable to be executed plus its arguments. |
environment(name, value) | Adds an environment variable to the environment for this process. |
environment(environmentVariables) | Adds some environment variables to the environment for this process. |
executable(executable) | Sets the name of the executable to use. |
workingDir(dir) | Sets the working directory for the process. The supplied argument is evaluated as per |
Sets the full command line, including the executable to be executed plus its arguments.
Sets the full command line, including the executable to be executed plus its arguments.
Adds an environment variable to the environment for this process.
Adds some environment variables to the environment for this process.
Sets the working directory for the process. The supplied argument is evaluated as perProject.file()
.