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

## Class EclipseClasspath

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

-     public class EclipseClasspath
      extends java.lang.Object

  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.

       plugins {
           id 'java'
           id '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

           //if you want to expose test classes to dependent projects
           containsTestFixtures = true
         }
       }

  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:

       plugins {
           id 'java'
           id '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 | Description
    --- | ---
    `EclipseClasspath​(Project project)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `containers​(java.lang.String... containers)` | Further classpath containers to be added.
    `void` | `file​(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.
    `void` | `file​(Action<? super XmlFileContentMerger> action)` | 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.
    `java.util.List<java.io.File>` | `getClassFolders()` |
    `java.util.Set<java.lang.String>` | `getContainers()` | The classpath containers to be added.
    `Property<java.lang.Boolean>` | `getContainsTestFixtures()` | Returns `true` if the classpath contains test fixture classes that should be visible through incoming project dependencies.
    `java.io.File` | `getDefaultOutputDir()` | The default output directory where Eclipse puts compiled classes.
    `XmlFileContentMerger` | `getFile()` | See `file(Action)`.
    `org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory` | `getFileReferenceFactory()` |
    `java.util.Collection<Configuration>` | `getMinusConfigurations()` | The configurations whose files are to be excluded from the classpath entries.
    `java.util.Map<java.lang.String,​java.io.File>` | `getPathVariables()` |
    `java.util.Collection<Configuration>` | `getPlusConfigurations()` | The configurations whose files are to be added as classpath entries.
    `Project` | `getProject()` |
    `java.lang.Iterable<SourceSet>` | `getSourceSets()` | The source sets to be added.
    `boolean` | `isDownloadJavadoc()` | Whether to download and associate Javadoc Jars with the dependency Jars.
    `boolean` | `isDownloadSources()` | Whether to download and associate source Jars with the dependency Jars.
    `boolean` | `isProjectDependenciesOnly()` |
    `void` | `mergeXmlClasspath​(Classpath xmlClasspath)` |
    `java.util.List<ClasspathEntry>` | `resolveDependencies()` | Calculates, resolves and returns dependency entries of this classpath.
    `void` | `setClassFolders​(java.util.List<java.io.File> classFolders)` |
    `void` | `setContainers​(java.util.Set<java.lang.String> containers)` |
    `void` | `setDefaultOutputDir​(java.io.File defaultOutputDir)` |
    `void` | `setDownloadJavadoc​(boolean downloadJavadoc)` |
    `void` | `setDownloadSources​(boolean downloadSources)` |
    `void` | `setFile​(XmlFileContentMerger file)` |
    `void` | `setMinusConfigurations​(java.util.Collection<Configuration> minusConfigurations)` |
    `void` | `setPathVariables​(java.util.Map<java.lang.String,​java.io.File> pathVariables)` |
    `void` | `setPlusConfigurations​(java.util.Collection<Configuration> plusConfigurations)` |
    `void` | `setProjectDependenciesOnly​(boolean projectDependenciesOnly)` |
    `void` | `setSourceSets​(java.lang.Iterable<SourceSet> sourceSets)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EclipseClasspath

          @Inject
          public EclipseClasspath​(Project project)

  - ### Method Detail

    - #### getSourceSets

          public java.lang.Iterable<SourceSet> getSourceSets()

      The source sets to be added.

      See `EclipseClasspath` for an example.

    - #### setSourceSets

          public void setSourceSets​(java.lang.Iterable<SourceSet> sourceSets)

    - #### getPlusConfigurations

          public java.util.Collection<Configuration> getPlusConfigurations()

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

      See `EclipseClasspath` for an example.

    - #### setPlusConfigurations

          public void setPlusConfigurations​(java.util.Collection<Configuration> plusConfigurations)

    - #### getMinusConfigurations

          public java.util.Collection<Configuration> getMinusConfigurations()

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

      See `EclipseClasspath` for an example.

    - #### setMinusConfigurations

          public void setMinusConfigurations​(java.util.Collection<Configuration> minusConfigurations)

    - #### getContainers

          public java.util.Set<java.lang.String> getContainers()

      The classpath containers to be added.

      See `EclipseClasspath` for an example.

    - #### setContainers

          public void setContainers​(java.util.Set<java.lang.String> containers)

    - #### getDefaultOutputDir

          public java.io.File getDefaultOutputDir()

      The default output directory where Eclipse puts compiled classes.

      See `EclipseClasspath` for an example.

    - #### setDefaultOutputDir

          public void setDefaultOutputDir​(java.io.File defaultOutputDir)

    - #### isDownloadSources

          public boolean isDownloadSources()

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

      See `EclipseClasspath` for an example.

    - #### setDownloadSources

          public void setDownloadSources​(boolean downloadSources)

    - #### isDownloadJavadoc

          public boolean isDownloadJavadoc()

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

      See `EclipseClasspath` for an example.

    - #### setDownloadJavadoc

          public void setDownloadJavadoc​(boolean downloadJavadoc)

    - #### getFile

          public XmlFileContentMerger getFile()

      See `file(Action)`.

    - #### setFile

          public void setFile​(XmlFileContentMerger file)

    - #### getPathVariables

          public java.util.Map<java.lang.String,​java.io.File> getPathVariables()

    - #### setPathVariables

          public void setPathVariables​(java.util.Map<java.lang.String,​java.io.File> pathVariables)

    - #### isProjectDependenciesOnly

          public boolean isProjectDependenciesOnly()

    - #### setProjectDependenciesOnly

          public void setProjectDependenciesOnly​(boolean projectDependenciesOnly)

    - #### getClassFolders

          public java.util.List<java.io.File> getClassFolders()

    - #### setClassFolders

          public void setClassFolders​(java.util.List<java.io.File> classFolders)

    - #### getProject

          public Project getProject()

    - #### containers

          public void containers​(java.lang.String... containers)

      Further classpath containers to be added.

      See `EclipseClasspath` for an example.

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

    - #### file

          public void file​(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.

    - #### file

          public void file​(Action<? super XmlFileContentMerger> action)

      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.

      Since:
        3.5

    - #### resolveDependencies

          public java.util.List<ClasspathEntry> resolveDependencies()

      Calculates, resolves and returns dependency entries of this classpath.

    - #### mergeXmlClasspath

          public void mergeXmlClasspath​(Classpath xmlClasspath)

    - #### getFileReferenceFactory

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

    - #### getContainsTestFixtures

          @Incubating
          public Property<java.lang.Boolean> getContainsTestFixtures()

      Returns `true` if the classpath contains test fixture classes that should be visible through incoming project dependencies.
      Since:
        6.8