A plugin I use fetches a property with `project.pr...
# community-support
m
A plugin I use fetches a property with
project.providers.gradleProperty(name)
, is there a way I can set this property in my build script? I need some custom logic to set it, but project.ext, gradle.extraProperties and even project.properties seem to all be ignored.
v
No
m
In that case, what should I do?
v
There is nothing you can do, except maybe doing the calculation in the Gradle wrapper script or using a custom Gradle distribution where you changed the Gradle implementation. There is no way I'm aware of to set a Project Property from build script, neither settings script, nor init script. When using
providers.gradleProperty
the value must come from the root project
gradle.properties
file, commandline
-P
switch, a system property, or an environment variable.
And the issue you entered will most likely be closed as works-as-designed by the Gradle folks
An `ext`/`extra` property is not a project property. It just takes precedence over project properties if a method to retrieve it is used that takes that into account like
project.findProperty
.
Basically what you are after is https://github.com/gradle/gradle/issues/16660
m
And the issue you entered will most likely be closed as works-as-designed by the Gradle folks
This is something I don't quite understand, they made an entire build system so you could use code to configure your build, then decide it's better to ignore that part and instead use property files for settings?
v
It's probably more questionable that a plugin uses project properties for configuration. They should provide extensions for configuration, optimally with
Property<...>
properties.
j
You should ask for a feature request to the plugin author in which the plugin extension is updated by adding a new property and the default value for it is picking the project property