Reputation: 146
I have two projects which are not linked in any way. I need them to have the same dependency and this dependency is another project, which can be edited anytime. So dependency tree must look like that (well, I'm not really good in drawing):
How do I do that?
Upvotes: 1
Views: 139
Reputation: 311
Here you have three projects. I think its better to keep these three projects in an archive, say EAR which is the root project. This will be easy to handle. So we can keep the root project name as Project. The structure will be: two independent projects, Project2 and Project3, with one common dependent Project1.
So we need to update the settings.gradle as:
rootProject.name = 'Project'
include 'Project2',':Project3'
include ':Project1'
And update the build.gradle of Project2 and Project3. Add the below code in both build.gradle file.
dependencies{
compile project(':Project1');
}
This will work.
Upvotes: 1
Reputation: 2030
Project 1 settings.gradle
:
rootProject.name = 'Project1'
include 'Project2, Project3'
Project 2 and 3 build.gradle
:
sourceSets.main{
compileClasspath=rootProject.sourceSets.main.output
}
Upvotes: 0