How are local gradle build dependencies handled?

Our gradle knowledge is coming along fine, but we still have some rough edges. For example, a developer can build the main product source in one directory (i.e. /home/foo/platform) and all is well. However we also need the developers to be able to build all the examples (/home/foo/examples) which is in a different folder hierarchy as well as it is currently modeled as a separate build. The examples build depends on a few artifacts from the platform build?

So my question is what is the best way to handle this? For the build server this is fine as the platform build would be published and then pulled by the examples build. However, most of our developers work disconnected and local to their laptops, so how should we structure the build files to refer to these artifacts?

If we do something like the following will there be duplicates and/or other bad stuff we don’t know about:

dependencies {
    compile 'org.foo:foo:1.0'
    compile fileTree(dir: "$projectDir/../foo/build-gradle/libs", include: 'foo-*.jar')
}

A common solution is to have one multi-project build that declares project dependencies, rather than having multiple builds. For more information, see the “multi-project builds” chapter in the Gradle User Guide.

OK, i re-read the chapter and I’m not quite sure of what you’re saying. If I have a project layout like

platform/

settings.gradle

build.gradle

A/

build.gradle

B/

build.gradle

The above would build the platform great. Now I also have examples like

examples/

settings.gradle

build.gradle

X/

build.gradle

Y/

build.gradle

Z/

build.gradle

Project Y needs the jar output from project A and project Z needs the war output from project B. The examples are not stored in a hierarchy matching the platform nor even in the same vcs (Perforce for the platform and Git for the examples). If I was to add the examples to the platform build then “gradle build” would try and build all the platform and the examples, which is not what we need as the platform devs aren’t concerned with the examples, other devs are. So is there a common practice for this other than open an enhancement?

The examples build could use external dependencies, or include the platform build via git submodules, whichever you prefer.