I’m having trouble referencing properties set in my root’s gradle.properties file. It seems like during the initialization phase of the build the Settings object being passed to my subproject is not complete.
This works fine for the core project, but for the plugin Gradle doesn’t substitute the property and tries to find the version $log4jVersion, not 1.2.16. I tried to print out $settingsDir and $rootDir in both build scripts, but Gradle could not find them in the plugin project.
Any ideas why my plugin project cannot reference the Settings object?
Putting the version numbers in double-quoted strings didn’t change anything. The CoreProject interprets the properties fine. As I said, the PluginA project is not given a Settings object (I cannot call $rootDir r $settingsDir in PluginA’s build.gradle). It seems the Settings is not initialized correctly for PluginA, which would mean the properties would not be inherited.
With single quoted strings, it will never work, no matter which script. The ‘Settings’ object is the object underlying ‘settings.gradle’, and I don’t see how it relates to the problem at hand. ‘rootDir’ is shorthand for ‘project.rootDir’, and is available in every build script. ‘settingsDir’ is only available in ‘settings.gradle’ (unless you defined your own property with that name). Properties specified in a top-level ‘gradle.properties’ are available in every build script (just double-checked for a multi-project build). If you need more help with this, please provide a self-contained minimal reproducible example.