Posted on stackoverflow: http://stackoverflow.com/q/28108370/1043419
I have a setup of (at least) two development projects (A and B) and a shared API
A is core and implements the API
B is integration and uses the API
The projects are separate in that I can deploy each separately. They are also in two separate repositories.
Use case 1: I’m working in core and only wants to see the released version of the API
Use case 2: I’m working on integration and only want to use the released version of API
Use case 3: I’m developing the API and want the source of both core (A) and integration (B)
You would need three completely separate builds. In use case 1 and 2 I would like to use a maven dependency, where I in use case 3 would like to use a gradle project dependency.
How would you setup your gradle builds to this (very common?) usage?
NOTE:
A way to think of it is when opening an IDE. In use case 1 and 2, the IDE would open the source of core and integration respectfully and using a jar-file dependency for API. For use case 3 the IDE would have sources for core, integration, and API (all three repos open)
My comment from stackoverflow: When you are working with the API (and not only one or the other side), you want to refactor among other things. (It’s not an external API). If API is a misleading word, then think of abstract module whose intent is inversion of control