Loading gradle.properties when executing from sub-project folder


(Corneil du Plessis) #1

We have a project with many sub-projects. We can import and use the project in Eclipse and IDEA. When we try to open a sub project in NetBeans it tries to execute some tasks with the ‘project folder’ set to the sub project folder and this fails because properties from gradle.properties is missing. I then tried using gradle on commandline from same sub project project and I noticed the same behaviour.

Is the NetBeans gradle plugin making a mistake or should I do something different?


(Peter Niederwieser) #2

What exactly is the setup that led you to notice the same problem on the command line? Sounds like the subproject isn’t recognized as a part of the whole build. I’m not sure if the Netbeans plugin supports opening just a subproject (I’d guess not).


(Corneil du Plessis) #3

Netbeans loads the project with all sub projects and places a gradle icon next to the sub-folders that would be seen be Eclipse as sub projects and by IDEA as modules. When you double click this folder NetBeans tries to ‘open’’ the sub-projects and invokves some take on gradle but it fails. When I try to invoke gradle in same folder it also fails because it can’t find properties from gradle.properties that is in the rootProject folder. It looks like gradle stops searching for a root when it finds a settings.gradle in the current folder and stops searching parent folders.

Shouldn’t gradle have an option to specify the folder of the rootProject in order to overcome the project when a settings.gradle is in a sub-project like the case where sub-projects have sub-projects a settings.gradle is needed to include the sub-projects?


(Peter Niederwieser) #4

A Gradle build can only have a single ‘settings.gradle’ file. Nested ‘settings.gradle’ files aren’t supported.


(Corneil du Plessis) #5

I have discovered that by removing the settings.gradle files from all sub projects the problem is resolved. There should probably only be a settings.gradle in the root project and not in any sub projects.