How does Gradle know dependencies of locally built external projects?

Say I have two projects that exist in separate SCM locations and one depends on the other. I have them both checked out and neither is deployed to a non-Gradle repository. Assume there is no such thing as Maven, since we are trying to be rid of it. How does Gradle know that artifacts from one project depend on artifacts from another?

Obviously Gradle isn;t clairvoyant, so you have to tell it in some form or another. These typically take on the form of:

  • Dependencies in a Maven, Ivy or flat directory repository.
  • Use of a project(':other:') directive in a dependency
  • Use of GradeBuild task to link to other Gradle project which is no a subproject or sibling of the curretn project
  • Linked projects as which is avaiable as a feature from Gradle 2.14+

Since you said they exist in separate SCM locations, I would take it to mean that you would check them out separately and have them on the same local filesystem, in which case the latter two of the above list applies.

If you meant it in a far more generic sense as just two projects that would exist some in the world, then the answer is simply it does not. All that project two knows us that you told it, it needs dependencies (which happens to have been built by project one). However, it will look for those dependencies in the repositories that you have listed and will have no clue as to how it got to those repositories. Frankly project two could care less about those artifacts, even if they have dropped out of a UFO.

BTW I am not sure what you mean by a non-Gradle repository. Currently the only concept in Gradle of a Gradle repo is when you have an Ivy repository that is laid out in

I am also not sure what you mean there is no Maven. Do you mean there is no ~/.m2? Or do you mean there is no Nexxus/Artifactory repository?