Sub-projects can't see parent project's properties

I have a multi-project build where the sub-projects call a common Gradle script in the parent project via:
apply from: '…/parentProject/common.gradle’
This common script references properties in in the parent project, same dir as the script.
When building the parent project, everything works fine but when trying to build just a sub-project I get an error
"Could not find property ‘X’, where X is a property referenced in common.gradle.
How do you get sub-projects to see the parent project’s

Is this happening in Buildship or from the cmd line?

Its happening in Buildship

Hi Ken. I had several attempts to reproduce the problem without success. It would be great if you could create a sample project exhibiting the problem. You can use this skeleton project (my last try) as a start.

How do you build just a sub-project from Buildship?

In the Gradle Tasks view, expand the node for the sub-project. Double-click the build node.

Also, my sub-projects are parallel to the parent project so I use “includeFlat” in the settings.gradle.

Here is a small multi-project that exhibits the issue. (247.3 KB)

Also, sub-projects cannot access classes from buildSrc of the parent. How do we make common code available to sub-projects?

It looks like that your issue happens on the command-line too is not specific to the IDE integration. I’ll change the category of this discussion.

In your example you define a settings.gradle file for each projects, which means they are all in different builds. You should have only one settings.gradle in the root project’s folder. When done, all projects will belong to one Gradle multi-module build and they will have access to the classes placed in the buildSrc folder.

I deleted the settings.gradle file from the sub-projects and that got the dummy project to build. But the problem remains in my real projects.

The sub-projects cannot access the extensions (specifically the Version class) located in the parent project when building a sub-project.

I agree that this is not a problem with BuildShip but with Gradle itself.

I may have discovered the problem. For some reason Gradle is not allowing properties with values that contain backslashes, even if they are escaped.

Example: deps.myrepo.ivy=\\\d\IvyCache
Example: deps.myrepo.ivy=\\\\\\d\\IvyCache

Both problems remain unsolved. Properties in cannot contain backslashes and sub-projects can’t resolve extensions in the root project.

I noticed that, in the multi-project I uploaded, when I run something like the properties task on a sub-project, the first thing it runs is “Build buildSrc”. It does not do that on our real projects.

What tells a sub-project that it is part of a multi-project?