EclipseClasspath (Gradle API 2.14.1)

Package: org.gradle.plugins.ide.eclipse.model

## [Java] Class EclipseClasspath

- org.gradle.plugins.ide.eclipse.model.EclipseClasspath

- The build path settings for the generated Eclipse project. Used by the GenerateEclipseClasspath task to generate an Eclipse .classpath file.

  The following example demonstrates the various configuration options. Keep in mind that all properties have sensible defaults; only configure them explicitly if the defaults don't match your needs.

       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 want to append extra containers:
           containers 'someFriendlyContainer', 'andYetAnotherContainer'

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

           //default settings for downloading sources and Javadoc:
           downloadSources = true
           downloadJavadoc = false
         }
       }

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

  The beforeMerged and whenMerged closures receive a 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
             }
           }
         }
       }

- - ### Constructor Summary

    Constructors
    Constructor and description
    `EclipseClasspath (Project project)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `containers(String... containers)` Further classpath containers to be added.
    `void` | `file(groovy.lang.Closure closure)` Enables advanced configuration like tinkering with the output XML or affecting the way that the contents of an existing .classpath file is merged with Gradle build information.
    `List<File>` | `getClassFolders()`
    `Set<String>` | `getContainers()` The classpath containers to be added.
    `File` | `getDefaultOutputDir()` The default output directory where Eclipse puts compiled classes.
    `boolean` | `getDownloadJavadoc()` Whether to download and associate Javadoc Jars with the dependency Jars.
    `boolean` | `getDownloadSources()` Whether to download and associate source Jars with the dependency Jars.
    `XmlFileContentMerger` | `getFile()` See file(Closure).
    `org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory` | `getFileReferenceFactory()`
    `Collection<Configuration>` | `getMinusConfigurations()` The configurations whose files are to be excluded from the classpath entries.
    `Collection<Configuration>` | `getNoExportConfigurations()` A subset of plusConfigurations whose files are not to be exported to downstream Eclipse projects.
    `Map<String, File>` | `getPathVariables()`
    `Collection<Configuration>` | `getPlusConfigurations()` The configurations whose files are to be added as classpath entries.
    `Project` | `getProject()`
    `boolean` | `getProjectDependenciesOnly()`
    `Iterable<SourceSet>` | `getSourceSets()` The source sets to be added.
    `boolean` | `isDownloadJavadoc()`
    `boolean` | `isDownloadSources()`
    `boolean` | `isProjectDependenciesOnly()`
    `void` | `mergeXmlClasspath(Classpath xmlClasspath)`
    `List<ClasspathEntry>` | `resolveDependencies()` Calculates, resolves and returns dependency entries of this classpath.
    `void` | `setClassFolders(List<File> classFolders)`
    `void` | `setContainers(Set<String> containers)`
    `void` | `setDefaultOutputDir(File defaultOutputDir)`
    `void` | `setDownloadJavadoc(boolean downloadJavadoc)`
    `void` | `setDownloadSources(boolean downloadSources)`
    `void` | `setFile(XmlFileContentMerger file)`
    `void` | `setMinusConfigurations(Collection<Configuration> minusConfigurations)`
    `void` | `setNoExportConfigurations(Collection<Configuration> noExportConfigurations)`
    `void` | `setPathVariables(Map<String, File> pathVariables)`
    `void` | `setPlusConfigurations(Collection<Configuration> plusConfigurations)`
    `void` | `setProjectDependenciesOnly(boolean projectDependenciesOnly)`
    `void` | `setSourceSets(Iterable<SourceSet> sourceSets)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class groovy.lang.GroovyObjectSupport` | `groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll()`
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### public EclipseClasspath(Project project)

  - ### Method Detail

    - #### public void containers(String... containers)

      Further classpath containers to be added.

      See EclipseClasspath for an example.

      Parameters:
        `containers` - the classpath containers to be added

    - #### public void file(groovy.lang.Closure closure)

      Enables advanced configuration like tinkering with the output XML or affecting the way that the contents of an existing .classpath file is merged with Gradle build information. The object passed to the whenMerged{} and beforeMerged{} closures is of type Classpath.

      See EclipseProject for an example.

    - #### public List<File> getClassFolders()

    - #### public Set<String> getContainers()

      The classpath containers to be added.

      See EclipseClasspath for an example.

    - #### public File getDefaultOutputDir()

      The default output directory where Eclipse puts compiled classes.

      See EclipseClasspath for an example.

    - #### public boolean getDownloadJavadoc()

      Whether to download and associate Javadoc Jars with the dependency Jars. Defaults to false.

      See EclipseClasspath for an example.

    - #### public boolean getDownloadSources()

      Whether to download and associate source Jars with the dependency Jars. Defaults to true.

      See EclipseClasspath for an example.

    - #### public XmlFileContentMerger getFile()

      See file(Closure).

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

    - #### public Collection<Configuration> getMinusConfigurations()

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

      See EclipseClasspath for an example.

    - #### public Collection<Configuration> getNoExportConfigurations()

      A subset of plusConfigurations whose files are not to be exported to downstream Eclipse projects.

      See EclipseClasspath for an example.

    - #### public Map<String, File> getPathVariables()

    - #### public Collection<Configuration> getPlusConfigurations()

      The configurations whose files are to be added as classpath entries.

      See EclipseClasspath for an example.

    - #### public Project getProject()

    - #### public boolean getProjectDependenciesOnly()

    - #### public Iterable<SourceSet> getSourceSets()

      The source sets to be added.

      See EclipseClasspath for an example.

    - #### public boolean isDownloadJavadoc()

    - #### public boolean isDownloadSources()

    - #### public boolean isProjectDependenciesOnly()

    - #### public void mergeXmlClasspath(Classpath xmlClasspath)

    - #### public List<ClasspathEntry> resolveDependencies()

      Calculates, resolves and returns dependency entries of this classpath.

    - #### public void setClassFolders(List<File> classFolders)

    - #### public void setContainers(Set<String> containers)

    - #### public void setDefaultOutputDir(File defaultOutputDir)

    - #### public void setDownloadJavadoc(boolean downloadJavadoc)

    - #### public void setDownloadSources(boolean downloadSources)

    - #### public void setFile(XmlFileContentMerger file)

    - #### public void setMinusConfigurations(Collection<Configuration> minusConfigurations)

    - #### public void setNoExportConfigurations(Collection<Configuration> noExportConfigurations)

    - #### public void setPathVariables(Map<String, File> pathVariables)

    - #### public void setPlusConfigurations(Collection<Configuration> plusConfigurations)

    - #### public void setProjectDependenciesOnly(boolean projectDependenciesOnly)

    - #### public void setSourceSets(Iterable<SourceSet> sourceSets)