All code in the apply(Project project)
method of the plugin executes on the apply plugin: GreetingPlugin
line, which includes the println
, so you’re printing the message the line before you set greet.message
.
You need to defer evaluation of your extension property until later. If the other plugin supports it, use Property<String>
instead of just String
. Otherwise, execute your code first in a task action (doFirst { }
), a separate task, or as a last resort, afterEvaluate { }
.