My root project isn't in the parent directory

(Chris Jones) #1

I’m in a corporate environment where, for legal reasons, certain people aren’t allowed to access certain sub-projects. Proj1 is general access, and proj2 is restricted. To make this work gracefully with SVN, we use svn:externals to include proj1 into proj2, making this structure:

  proj2  ±- proj2:subA  ±- proj1

±- proj1:subB

±- proj1:subC

Proj1 needs to have a standalone build system. Proj2 depends on proj1.

I’ve built a Gradle-based build system in proj1 that works quite well, but I don’t know a good way to extend it to work with proj2 or proj2:subA. Proj1 is where my root project lives, with settings.gradle and a build.gradle that injects configuration into all the subprojects.

(Peter Niederwieser) #2

What is it exactly that you are trying to achieve, and which problem are you facing?

(Chris Jones) #3

My goal: proj2/proj1 is the location of the root project. It supports proj2/proj1/subB and proj2/proj1/subC. It needs to also support proj2/subA.

Problem: If I add “include ‘…/proj2/subA’” to my settings.gradle, Gradle complains that it can’t find that project.

(Peter Niederwieser) #4

What comes after “include” is the logical path of the subproject, not the physical path. Try this:

include "proj2:subA"
  project(":proj2:subA").projectDir = new File(rootDir, "../proj2/subA")

If you don’t want proj2 to be part of the logical project structure, this becomes:

include "subA"
  project(":subA").projectDir = new File(rootDir, "../proj2/subA")