Consider the following gradle build script:
task a { doLast { println 'A' }
}
task b(dependsOn: a)
{ dolast { println 'B' }
}
task c(dependsOn: a)
{ doLast { println 'C' }
}
If the task gradle -qc is run, what is the output?
Answers
Answer:
User Manual
Build Script Basics
Contents
Projects and tasks
Hello world
Build scripts are code
Task dependencies
Dynamic tasks
Manipulating existing tasks
Groovy DSL shortcut notations
Extra task properties
Using Ant Tasks
Using methods
Default tasks
Configure by DAG
External dependencies for the build script
Further Reading
This chapter introduces you to the basics of writing Gradle build scripts. For a quick hands-on introduction, try the Creating New Gradle Builds guide.
Projects and tasks
Everything in Gradle sits on top of two basic concepts: projects and tasks.
Every Gradle build is made up of one or more projects. What a project represents depends on what it is that you are doing with Gradle. For example, a project might represent a library JAR or a web application. It might represent a distribution ZIP assembled from the JARs produced by other projects. A project does not necessarily represent a thing to be built. It might represent a thing to be done, such as deploying your application to staging or production environments. Don’t worry if this seems a little vague for now. Gradle’s build-by-convention support adds a more concrete definition for what a project is.
Each project is made up of one or more tasks. A task represents some atomic piece of work which a build performs. This might be compiling some classes, creating a JAR, generating Javadoc, or publishing some archives to a repository.
Explanation: