I have a task (written in Java, wrapped in a Plugin) that has a couple of boolean configuration flags that affect the files that are being generated by that task. I have annotated the boolean configuration properties in the task class like so:
@Input
private Boolean featureEnabled = true;
Configuring the task in build.gradle:
generateSomeSource {
featureEnabled = true
}
The problem is that gradle considers my task up-to-date and doesn’t run it, even if I change the configuration flag in build.gradle.
I have generated public accessor methods in the task class, I tried to annotate the getter instead of the field and I tried primitive “boolean” and Object “Boolean”. Nothing seems to work. If I use a java.lang.String instead of the booleans, gradle behaves as expected.
Is that a bug? Should I file a jira ticket? Or am I missing something?
I’m afraid this won’t be very helpful for you. But the fact that it works as expected for you hints at an error on my side. I’ll have to hunt down the issue tomorrow, starting with an empty task. I’ll report back when I find something
Apparently, gradle ignores the @Input annotation if it doesn’t find a method starting with “get” (note the getter method name “isFeature1Enabled” vs. “getFeature1Enabled”).