Monday 8 June 2015

External Project Dependency in Gradle

Lets assume that you are working in a multi-module and distributed project and projects are organised like the structure below -

root1
       |__ project _1
       |__ project _2

root2
        |__ project _X
        |__ project _Y


Now we want to add dependency of project_1 of root1 in project_Y of root2, If you achieve that easily with -

1. Add the snippet below in settings.gradle file of project_Y

include ":project_1"
project(":project_1").projectDir = file("<path_to_project_1>")

2. Add dependency of project_1 in build.gradle file of project_Y

compile project(":project_1")

No comments:

Post a Comment