Skip to content

Commit e4aeafd

Browse files
committed
Support Gradle back-end dependencies management framework #300
1 parent 03b5254 commit e4aeafd

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

docs/tutorials/gradle/gradle-essentials.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -714,21 +714,21 @@ However, the include method allows level 1 subproject names to omit the colon.
714714
So, the include call can be rewritten as follows: `include 'repository', 'services', 'web-app'`
715715
- The projects task lists all the projects available in a Gradle build: `gradle projects`
716716
- We can find more information on Settings at the Settings DSL documentation https://docs.gradle.org/current/dsl/org.gradle.api.initialization.Settings.html
717-
- For a multiproject build, we can call tasks on any nested project using the gradle <project-path>:<task-name> syntax
718-
or by going into the subproject directory and executing gradle <task-name>.
717+
- For a multiproject build, we can call tasks on any nested project using the gradle <project-path>:<task-name> syntax
718+
or by going into the subproject directory and executing gradle <task-name>.
719719

720720
### Organizing build logic in multiproject builds
721-
- Gradle gives us the flexibility to create one build file for all projects or individual build file per project; you can also mix and match.
721+
- Gradle gives us the flexibility to create one build file for all projects or individual build file per project; you can also mix and match.
722722
- Gradle DSL provides a first-class support for declaring common build elements across all projects.
723723
- The allprojects method takes a closure and executes it on the project (object) of the build file and all the subprojects of the current project.
724-
- We can even apply plugins, declare repositories and dependencies, and so on. So, in essence, we can write any build logic
724+
- We can even apply plugins, declare repositories and dependencies, and so on. So, in essence, we can write any build logic
725725
that is common to all projects and then it will be applied to all projects.
726726

727727
```
728728
allprojects {
729729
task whoami << {println "I am ${project.name}"}
730730
}
731-
// or
731+
// or
732732
allprojects {
733733
task("describe${project.name.capitalize()}") << {
734734
println project.name
@@ -737,13 +737,35 @@ allprojects {
737737
```
738738

739739
### Applying build logic to subprojects
740-
- the subprojects method applies some build logic only on subprojects without affecting the parent project.
741-
-
740+
- the subprojects method applies some build logic only on subprojects without affecting the parent project.
741+
-
742742

743743
```
744744
subprojects {
745745
apply plugin: 'java'
746746
}
747747
```
748748

749+
- Check the output of `gradle -q tasks --all` in this case.
750+
- The tasks added by the `java` plugin will only be available on subprojects, whereas tasks such
751+
as help tasks will be available on all projects.
752+
753+
### Dependency on subprojects
754+
- Add dependency declaration in the root project's build.gradle.
755+
756+
```
757+
project(':services') {
758+
dependencies {
759+
compile project(':repository')
760+
}
761+
}
762+
```
763+
764+
- Add dependency declaration in the child project's build.gradle.
765+
766+
```
767+
dependencies {
768+
compile project(':services')
769+
}
770+
```
749771

0 commit comments

Comments
 (0)