Can sub project dependent on or use some files or packages from the root project in gradle?
I have the following project:
root
├── project1
├── build.gradle
└── src
├── settings.gradle
I have the settings.gradle
as following:
include 'project1'
The project1 need to use some files and packages from src
of the root
which is the root project, is there a way to do it?
I recommend this structure as it's more flexible and manageable. root will be just a wrapper and will contain subprojects only.
root
├── project1 (dependent on project 2)
| |
| |__build.gradle
|
|
|__ project2
| |
| |__ src
| |__ build.gradle
|
├── build.gradle
├── settings.gradle
settings.gradle
include 'project1'
include 'project2'
EDIT: If you need to have dependency on root, use following dependency in project1 :
dependencies {
compile project(':root')
}
In settings.gradle
rootProject.name = 'root'
include 'project1'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.