I’m assuming the Plugin refer to is not a Gradle plugin, but something of your own. I am also going to take the convention of using lower-case plugin for my example
class FeaturePlugin {
String url
String prop
}
class Feature extends DefaultTask {
void plugin(String pluginId, @DelegatesTo(FeaturePlugin) Closure configurator) {
Closure cfg = configurator.clone()
cfg.delegate = maybeCreate(pluginId)
cfg.resolveStrategy = Closure.DELEGATE_FIRST
cfg.call()
}
void plugin(String pluginId, Action<FeaturePlugin> configurator) {
configurator.execute(maybeCreate(pluginId))
}
private FeaturePlugin maybeCreate( String pluginId ) {
// You need to decide what you are going to do to return a FeaturePlugin
}
}