Use @Option together with task closure

I am trying to use @Option to expose a custom command line option for configuring a JavaExec task. I attempted to do it like this in my build.gradle file:

class MyJavaExec extends JavaExec {
  @Option(description="Configure XYZ")
  def String xyz;
task runXyz(type: MyJavaExec) {
  systemProperties += ['': xyz]
  main = 'com.MyMain'

I then execute the task with gradle runXyz --xyz=something
The problem is that this ends up setting my system property to null. How can I do this to get hold of the value set with the command line option?