This message was deleted.
# community-support
s
This message was deleted.
m
We have a number of tasks that are configured like so:
Copy code
tasks.register<JavaExec>("encryptKey") {
    onlyIf {
        project.hasProperty("key")
    }

    args(project.property("key"))
}
onlyIf
is only executed in the execution phase, but the configuration of the task happens during a IDE sync. If the
key
property doesn't exist, the
Project.property
throws. Is there a
Provider
specifically for project properties? Or should I create a generic one like:
Copy code
project.provider { project.property("key") }
My understanding is that
Provider.get()
will be called during execution time
e
You can use
providers.gradleProperty(...)
to get a
Provider
whose value is the property value.
m
Does
gradleProperty
look at properties passed by
-P
? The docs seem to suggest it's a gradle property from like
gradle.properties
e
Yes, it looks at properties passed in by
-P
as well.
🙌 1
m
Word, thanks @Eric Haag!
e
My pleasure!