Lets assume there are two projects: Project1/module1 and Project2/module2, and module2 depends on a JAR file built by module1.
Step 1: Declare repository in Project2/module2/build.gradle
repositories {
flatDir {
dirs new File(project.rootDir,
"/../Project1/module1/build/libs")
}
}
Step 2: Declare dependency in Project2/module2/build.gradle
dependencies {
compile ':module1-1.0-SNAPSHOT'
}
This quick solution works really well if you need to iterate fast and don't want to setup a local maven repository.
Step 1: Declare repository in Project2/module2/build.gradle
repositories {
flatDir {
dirs new File(project.rootDir,
"/../Project1/module1/build/libs")
}
}
Step 2: Declare dependency in Project2/module2/build.gradle
dependencies {
compile ':module1-1.0-SNAPSHOT'
}
All you need to do now is to run JAR gradle task in Project1/module1. It'll place module1-1.0.SNAPSHOT.jar into Project1/module1/build/libs folder. After that Project2/module2 will be able to access that jar. Note that you need a colon (':') in front of 'module1-1.0-SNAPSHOT'.
This quick solution works really well if you need to iterate fast and don't want to setup a local maven repository.