Thursday, May 21, 2020

How to setup gradle based project to depend on source of another project for local development/debugging?

While working on gradle based project in intellij, many time we want to change its dependency temporarily to local source so that such dependent can be modified and tested locally before publishing and consuming back as artifact/jar. Here is the quick setup I know of:
1. Let's say you have Project A depends on Project B. And you needed some changes on B and test from A. Add following into settings.gradle or build.gradle of Project A
include”:B”
project(‘:B’).projectDir=new File(settingsDir,‘ path-to-project-B-root-folder’) 
finally add compile(project(“:B”)) into build.gradle. If you now open the project A in intellij, you should be able to make necessary changes into project B source and immediately validate on Project A.