LifeCycle
Phase
######Initialization
Gradle determines which projects are going to take part in the build, and creates a Project instance for each of these projects
######Configuration
The build scripts of all projects which are part of the build are executed
Execution
Gradle determines the subset of the tasks, created and configured during the configuration phase, to be executed
setting files
settings.gradle
- The settings file is executed during the initialization phase. A multiproject build must have a settings.gradle, for singleproject it’s optional.
- building tree1include 'project1', 'project2:child', 'project3:child1'
build.gradle
- are build scrpit files
- defines a project in Gradle
- execute after initialization
language(script)
everything sits on top of two basic concepts: projects and tasks.
You run a Gradle build using the gradle command. The gradle command looks for a file called build.gradle in the current directory
concepts
project
What a project represents depends on what it is that you are doing with Gradle
task
Each project is made up of one or more tasks. A task represents some atomic piece of work which a build performs
task dependencies
build.gradle
cmdline
with the -q command-line option. This suppresses Gradle’s log messages
task manipulating
via API
add dependency
task0.dependsOn task2, task3
add behaviour
The calls doFirst and doLast can be executed multiple times. They add an action to the beginning or the end of the task’s actions list. When the task executes, the actions in the action list are executed in order.
|
|
JAVA
CMDS
gradle tasks
: list the tasks of a project.gradle build
: Gradle will compile and test your code, and create a JAR file containing your main classes and resourcesgradle clean
: Deletes the build directory, removing all built files.gradle assemble
: Compiles and jars your code, but does not run the unit testsgradle check
: Compiles and tests your code