I have a task changeValue
that I want to run optionally. Assume my plugin somePlugin
has a task called pluginTask
.
When I run gradlew pluginTask
I want the value to be someValue
.
When I run gradlew changeValue pluginTask
I want the value to be somethingElse
.
For the 2nd scenario, right now I still get someValue
. It's being evaluated during gradle's configuration phase as opposed to execution phase. How can I resolve this?
String value = 'someValue'
task changeValue() << {
value = 'somethingElse'
}
somePlugin {
source = ${value}
}