Groovy Documentation

org.gradle.plugins.ide.eclipse.model
[Groovy] Class EclipseProject

java.lang.Object
  org.gradle.plugins.ide.eclipse.model.EclipseProject

class EclipseProject
extends java.lang.Object

DSL-friendly model of the eclipse project needed for .project generation

Example of use with a blend of all possible properties. Bear in mind that usually you don't have configure eclipse project directly because Gradle configures it for free!

 apply plugin: 'java'
 apply plugin: 'eclipse'

 eclipse {
   project {
     //if you don't like the name Gradle has chosen
     name = 'someBetterName'

     //if you want to specify the Eclipse project's comment
     comment = 'Very interesting top secret project'

     //if you want to append some extra referenced projects in a declarative fashion:
     referencedProjects 'someProject', 'someOtherProject'
     //if you want to assign referenced projects
     referencedProjects = ['someProject'] as Set

     //if you want to append some extra natures in a declarative fashion:
     natures 'some.extra.eclipse.nature', 'some.another.interesting.nature'
     //if you want to assign natures in a groovy fashion:
     natures = ['some.extra.eclipse.nature', 'some.another.interesting.nature']

     //if you want to append some extra build command:
     buildCommand 'buildThisLovelyProject'
     //if you want to append a build command with parameters:
     buildCommand argumentOne: "I'm first", argumentTwo: "I'm second", 'buildItWithTheArguments'

     //if you want to create an extra link in the eclipse project,
     //by location uri:
     linkedResource name: 'someLinkByLocationUri', type: 'someLinkType', locationUri: 'file://someUri'
     //by location:
     linkedResource name: 'someLinkByLocation', type: 'someLinkType', location: '/some/location'
   }

   jdt {
     //if you want to alter the java versions (by default they are configured with gradle java plugin settings):
     sourceCompatibility = 1.6
     targetCompatibility = 1.5
   }
 }
 
Author: Szczepan Faber, created at: 4/13/11


Property Summary
java.util.List buildCommands

The build commands to be added to this Eclipse project.

java.lang.String comment

A comment used for the eclipse project.

java.util.Set linkedResources

The linked resources to be added to this Eclipse project.

java.lang.String name

Configures eclipse project name.

java.util.List natures

The natures to be added to this Eclipse project.

java.util.Set referencedProjects

The referenced projects of this Eclipse project.

 
Method Summary
void buildCommand(java.util.Map args, java.lang.String buildCommand)

Adds a build command with arguments to the eclipse project.

void buildCommand(java.lang.String buildCommand)

Adds a build command to the eclipse project.

void linkedResource(java.util.Map args)

Adds a resource link (aka 'source link') to the eclipse project.

void mergeXmlProject(Project xmlProject)

void natures(java.lang.String natures)

Appends natures entries to the eclipse project.

void referencedProjects(java.lang.String referencedProjects)

Adds project references to the eclipse project.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

buildCommands

java.util.List buildCommands
The build commands to be added to this Eclipse project.

For example see docs for EclipseProject


comment

java.lang.String comment
A comment used for the eclipse project. By default it will be configured to project.description

For example see docs for EclipseProject


linkedResources

java.util.Set linkedResources
The linked resources to be added to this Eclipse project.

For example see docs for EclipseProject


name

java.lang.String name
Configures eclipse project name. It is optional because the task should configure it correctly for you. By default it will try to use the project.name or prefix it with a part of a project.path to make sure the moduleName is unique in the scope of a multi-module build. The 'uniqeness' of a module name is required for correct import into Eclipse and the task will make sure the name is unique.

The logic that makes sure project names are uniqe is available since 1.0-milestone-2

For example see docs for EclipseProject


natures

java.util.List natures
The natures to be added to this Eclipse project.

For example see docs for EclipseProject


referencedProjects

java.util.Set referencedProjects
The referenced projects of this Eclipse project.

For example see docs for EclipseProject


 
Method Detail

buildCommand

void buildCommand(java.util.Map args, java.lang.String buildCommand)
Adds a build command with arguments to the eclipse project.

For example see docs for EclipseProject

Parameters:
args - A map with arguments, where the key is the name of the argument and the value the value.
buildCommand - The name of the build command.
See Also:
buildCommand(String)


buildCommand

void buildCommand(java.lang.String buildCommand)
Adds a build command to the eclipse project.

For example see docs for EclipseProject

Parameters:
buildCommand - The name of the build command
See Also:
buildCommand(Map, String)


linkedResource

void linkedResource(java.util.Map args)
Adds a resource link (aka 'source link') to the eclipse project.

For example see docs for EclipseProject

Parameters:
args - A maps with the args for the link. Legal keys for the map are name, type, location and locationUri.


mergeXmlProject

void mergeXmlProject(Project xmlProject)
*


natures

void natures(java.lang.String natures)
Appends natures entries to the eclipse project.

For example see docs for EclipseProject

Parameters:
natures - the nature names


referencedProjects

void referencedProjects(java.lang.String referencedProjects)
Adds project references to the eclipse project.
Parameters:
referencedProjects - The name of the project references.


 

Groovy Documentation