Search code examples
javagradleintellij-ideamulti-project

How to attach source code as dependency in java


I have two projects in java. ProjectA is published into artifactory, and projectAB has jar of projectA as a dependency.

When I make changes in projectA, in order to completely test it, I need to run tests in projectAB (these tests can not be moved into projectA).

What I want is to make changes in projectA, and instantly run tests in projectAB.

Naive schema: change projectA, publish projectA, test projectAB looks too complex.

Idealy for me, I'd like to set in my IDE to override projectA.jar dependency with project A, so I can threat projectA and projectAB as the single project. But I havent found a way to do it.

I use IDEA as IDE and Gradle as a build system


Solution

  • Please consider using Gradle composite builds or Gradle multi-projects that were made exactly for this purpose.