How to write properties to 3rd party Eclipse .settings files?

Here’s what I came up with:

doLast {
  def props = new Properties()
  file(".settings/com.google.gdt.eclipse.core.prefs").withInputStream {
   stream -> props.load(stream)
  }
  props.setProperty("warSrcDir", "src/main/webapp")
  props.setProperty("warSrcDirIsOutput", "true")
  file(".settings/com.google.gdt.eclipse.core.prefs").withOutputStream {
   stream -> props.store(stream, null)
  }
 }

However, Gradle would not let me add this to the eclipse task. It says there is no doLast() method. I also tried adding it in a separate task, and creating a dependency on that task in eclipse, and Gradle tells me there is also no dependsOn() method.

Is the eclipse task not a standard task?

I was able to get it working by adding it to the eclipseProject task instead.