Is it possible to have a child project that comes from a directory above the main project?

Module A is the main module and is needed by ProjectB and ProjectC. The directory structure is

/Module/ModuleA /Projects/ProjectB /Projects/ProjectC

So I would live to be able to have projectB (or C) depend on ModuleA. Is this possible?

Yes it’s possible. See the multi-project builds chapter in the Gradle user guide, in particular the custom layout section.

One thing to keep in mind is that if ‘settings.gradle’ is not in a common parent directory, you lose the ability to cd into a subproject directory and run the build from there. (You can still run a single task by using the task’s fully qualified pathname though.)

Thank you for your response. I have read through those chapers, but I’m not having any luck changing ModuleA’s buildpath

settings.gradle (in ProjectB)

rootProject.name = 'Project B'
project(':projectA').projectDir = new File(settingsDir, '../modules/ModuleA')
include projectA

I’m seeing this error however: Project with path ‘:projectA’ could not be found. I’m sure I’m missing something fairly obvious, but I can’t seem to narrow it down.

Thanks again for your time.

The ‘include’ has to come first as it “declares” the project.

ha. of course.

Thanks.