Add Gradle nature to eclipse .project

I don’t understand how to add Gradle nature to eclipse .project file.

The documentation on the eclipse plugin is clear but I don’t know where to find details on its usage. I have tried adding the following to build.gradle and running gradle eclipseProject:

eclipse.project.file.whenMerged { project ->
 project.natures += org.springsource.ide.eclipse.gradle.core.nature
}

Is there more detailed documentation somewhere in addition to:

http://gradle.org/docs/current/userguide/eclipse_plugin.html

Many thanks, Peter

The DSL reference is a good source if you just need to know what options are available. In general, with Eclipse stuff, using the models (i.e. what I linked to, and also the links from the Configuration section of the user guide page you linked to).

I would assume what you did would fail with some type of property missing exception, but interacting with the model you could do the following:

eclipse.project {
  natures 'org.springsource.ide.eclipse.gradle.core.nature'
}

Andrew, apologies for the tardy acknowledgement. Got it, many thanks for your help.