Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## org.gradle.plugins.ide.eclipse.model
[Groovy] Class EclipseClasspath

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

    class EclipseClasspath
    extends java.lang.Object

Enables fine-tuning classpath details (.classpath file) of the Eclipse plugin

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

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

     configurations {
       provided
       someBoringConfig
     }

     eclipse {

       //if you want parts of paths in resulting file to be replaced by variables (files):
       pathVariables 'GRADLE_HOME': file('/best/software/gradle'), 'TOMCAT_HOME': file('../tomcat')

       classpath {
         //you can tweak the classpath of the eclipse project by adding extra configurations:
         plusConfigurations += configurations.provided

         //you can also remove configurations from the classpath:
         minusConfigurations += configurations.someBoringConfig

         //if you don't want some classpath entries 'exported' in eclipse
         noExportConfigurations += configurations.provided

         //if you want to append extra containers:
         containers 'someFriendlyContainer', 'andYetAnotherContainer'

         //customizing the classes output directory:
         defaultOutputDir = file('build-eclipse')

         //default settings for dependencies sources/javadoc download:
         downloadSources = true
         downloadJavadoc = false
       }
     }

For tackling edge cases users can perform advanced configuration on resulting xml file. It is also possible to affect the way eclipse plugin merges the existing configuration via beforeMerged and whenMerged closures.

beforeMerged and whenMerged closures receive Classpath object

Examples of advanced configuration:

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

     eclipse {
       classpath {
         file {
           //if you want to mess with the resulting xml in whatever way you fancy
           withXml {
             def node = it.asNode()
             node.appendNode('xml', 'is what I love')
           }

           //closure executed after .classpath content is loaded from existing file
           //but before gradle build information is merged
           beforeMerged { classpath ->
             //you can tinker with the Classpath here
           }

           //closure executed after .classpath content is loaded from existing file
           //and after gradle build information is merged
           whenMerged { classpath ->
             //you can tinker with the Classpath here
           }
         }
       }
     }

Authors:
  Szczepan Faber, created at: 4/16/11

Property Summary
`java.util.List` | `classFolders`
`java.util.Set` | `containers` Containers to be added to the classpath For example see docs for EclipseClasspath
`java.io.File` | `defaultOutputDir` The default output directory where eclipse puts compiled classes For example see docs for EclipseClasspath
`boolean` | `downloadJavadoc` Whether to download and add javadocs associated with the dependency jars.
`boolean` | `downloadSources` Whether to download and add sources associated with the dependency jars.
`XmlFileContentMerger` | `file` See file(Closure)
`java.util.Collection` | `minusConfigurations` The configurations which files are to be excluded from the classpath entries.
`java.util.Collection` | `noExportConfigurations` The included configurations (plusConfigurations) which files will not be exported.
`java.util.Map` | `pathVariables`
`java.util.Collection` | `plusConfigurations` The configurations which files are to be transformed into classpath entries.
`java.lang.Object` | `project` *
`boolean` | `projectDependenciesOnly`
`java.lang.Iterable` | `sourceSets` The source sets to be added to the classpath.

Constructor Summary
`EclipseClasspath(java.lang.Object project)`

Method Summary
`void` | `containers(java.lang.String containers)` Adds containers to the .classpath.
`void` | `file(groovy.lang.Closure closure)` Enables advanced configuration like tinkering with the output xml or affecting the way existing .classpath content is merged with gradle build information The object passed to whenMerged{} and beforeMerged{} closures is of type Classpath
`org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory` | `getFileReferenceFactory()`
`void` | `mergeXmlClasspath(Classpath xmlClasspath)`
`java.util.List` | `resolveDependencies()` Calculates, resolves & returns dependency entries of this classpath

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

### classFolders

    java.util.List classFolders

### containers

    java.util.Set containers

  Containers to be added to the classpath

  For example see docs for EclipseClasspath

### defaultOutputDir

    java.io.File defaultOutputDir

  The default output directory where eclipse puts compiled classes

  For example see docs for EclipseClasspath

### downloadJavadoc

    boolean downloadJavadoc

  Whether to download and add javadocs associated with the dependency jars. Defaults to false.

  For example see docs for EclipseClasspath

### downloadSources

    boolean downloadSources

  Whether to download and add sources associated with the dependency jars. Defaults to true.

  For example see docs for EclipseClasspath

### file

    XmlFileContentMerger file

  See file(Closure)

### minusConfigurations

    java.util.Collection minusConfigurations

  The configurations which files are to be excluded from the classpath entries.

  For example see docs for EclipseClasspath

### noExportConfigurations

    java.util.Collection noExportConfigurations

  The included configurations (plusConfigurations) which files will not be exported. Only make sense if those configurations are also a part of plusConfigurations

  For example see docs for EclipseClasspath

### pathVariables

    java.util.Map pathVariables

### plusConfigurations

    java.util.Collection plusConfigurations

  The configurations which files are to be transformed into classpath entries.

  For example see docs for EclipseClasspath

### project

    final java.lang.Object project

  **

### projectDependenciesOnly

    boolean projectDependenciesOnly

### sourceSets

    java.lang.Iterable sourceSets

  The source sets to be added to the classpath.

  For example see docs for EclipseClasspath

Constructor Detail

### EclipseClasspath

    EclipseClasspath(java.lang.Object project)

Method Detail

### containers

    void containers(java.lang.String containers)

  Adds containers to the .classpath.

  For example see docs for EclipseClasspath

  Parameters:
    `containers` - the container names to be added to the .classpath.

### file

    void file(groovy.lang.Closure closure)

  Enables advanced configuration like tinkering with the output xml or affecting the way existing .classpath content is merged with gradle build information

  The object passed to whenMerged{} and beforeMerged{} closures is of type Classpath

  For example see docs for EclipseProject

### getFileReferenceFactory

    org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory getFileReferenceFactory()

### mergeXmlClasspath

    void mergeXmlClasspath(Classpath xmlClasspath)

### resolveDependencies

    java.util.List resolveDependencies()

  Calculates, resolves & returns dependency entries of this classpath

Groovy Documentation