Multi-project build with different directory layout in jenkins

In my settings.gradle file, I have a dependency on a sub project:

'includeFlat subProject'

Everything works great. However, when I try and run it from Jenkins, it cannot find the subProject because the directory layout is different:

Project
  workspace
      build.gradle
SubProject
  workspace
      build.gradle

I can make it work for Jenkins by setting the projectDir in settings.gradle:

project(':SubProject').projectDir = new File (/path/to/SubProject/workspace)

how can I make it work for both my local build (includeFlat layout) and the slightly different layout that is used for Jenkins? The jenkins build is ran by the jenkins user, can I somehow check for that and then dynamically set the projectDir path? Is there an easy way to do this? Am I not going about this the right way? thanks!

We have the exactly same problem. Please help!

Another guy had the same problem. http://forums.gradle.org/gradle/topics/how_to_declare_dependent_project_that_are_not_side_by_side_built_with_jenkins