Gradle include library from another project


(Padmanabhan Vijendran) #1

I have this project setup (in Eclipse IDE):

|---Project1  
|     |---App  
|     |---lib
|          |---xxx.jar
|
|---Project2  
     |---App

I want add project 1 lib jar as dependency to Project2.

Project2 settings.gradle:

include ':Project1'
project(':Project1').projectDir = new File(settingsDir, '../Project1')

Project2 build.gradle:

compile project(':Project1')
compile files(fileTree(dir: '../Project1/lib', includes: ['*.jar']))

But When I run the Project2 jar from command , I am getting dependency errors…

Is there anything wrong with the folder path? I didn’t find any good solution for this problem and i am not very familiar with gradle.