EclipseWtpComponent (Gradle API 2.14)
Date: 2016-06-14

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

## [Java] Class EclipseWtpComponent

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

- Enables fine-tuning wtp component details of the Eclipse plugin

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

       apply plugin: 'java'
       apply plugin: 'war'
       apply plugin: 'eclipse-wtp'

       configurations {
         someInterestingConfiguration
         anotherConfiguration
       }

       eclipse {

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

         wtp {
           component {
             //you can configure the context path:
             contextPath = 'someContextPath'

             //you can configure the deployName:
             deployName = 'killerApp'

             //you can alter the wb-resource elements. sourceDirs is a ConventionProperty.
             //non-existing source dirs won't be added to the component file.
             sourceDirs += file('someExtraFolder')

             //you can alter the files are to be transformed into dependent-module elements:
             plusConfigurations += [ configurations.someInterestingConfiguration ]

             //or whose files are to be excluded from dependent-module elements:
             minusConfigurations << configurations.anotherConfiguration

             //you can add a wb-resource elements; mandatory keys: 'sourcePath', 'deployPath':
             //if sourcePath points to non-existing folder it will *not* be added.
             resource sourcePath: 'extra/resource', deployPath: 'deployment/resource'

             //you can add a wb-property elements; mandatory keys: 'name', 'value':
             property name: 'moodOfTheDay', value: ':-D'
           }
         }
       }

  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 WtpComponent object

  Examples of advanced configuration:

       apply plugin: 'java'
       apply plugin: 'war'
       apply plugin: 'eclipse-wtp'

       eclipse {

         wtp {
           component {
             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 wtp component file content is loaded from existing file
               //but before gradle build information is merged
               beforeMerged { wtpComponent ->
                 //tinker with WtpComponent here
               }

               //closure executed after wtp component file content is loaded from existing file
               //and after gradle build information is merged
               whenMerged { wtpComponent ->
                 //you can tinker with the WtpComponent here
               }
             }
           }
         }
       }

- - ### Constructor Summary

    Constructors
    Constructor and description
    `EclipseWtpComponent (Project project, XmlFileContentMerger file)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `file(groovy.lang.Closure closure)` Enables advanced configuration like tinkering with the output XML or affecting the way existing wtp component file content is merged with gradle build information
    `String` | `getClassesDeployPath()` The deploy path for classes.
    `String` | `getContextPath()` The context path for the web application
    `String` | `getDeployName()` The deploy name to be used.
    `XmlFileContentMerger` | `getFile()` See file(Closure)
    `org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory` | `getFileReferenceFactory()`
    `Set<Configuration>` | `getLibConfigurations()` The configurations whose files are to be transformed into dependent-module elements with a deploy path of getLibDeployPath().
    `String` | `getLibDeployPath()` The deploy path for libraries.
    `Set<Configuration>` | `getMinusConfigurations()` The configurations whose files are to be excluded from dependent-module elements.
    `Map<String, File>` | `getPathVariables()` The variables to be used for replacing absolute path in dependent-module elements.
    `Set<Configuration>` | `getPlusConfigurations()` Synonym for getLibConfigurations().
    `Project` | `getProject()`
    `List<WbProperty>` | `getProperties()` Additional property elements.
    `List<WbResource>` | `getResources()` ConventionProperty for additional wb-resource elements.
    `Set<Configuration>` | `getRootConfigurations()` The configurations whose files are to be transformed into dependent-module elements with a deploy path of '/'.
    `Set<File>` | `getSourceDirs()` ConventionProperty for the source directories to be transformed into wb-resource elements.
    `void` | `mergeXmlComponent(WtpComponent xmlComponent)`
    `void` | `property(Map<String, String> args)` Adds a property.
    `void` | `resource(Map<String, String> args)` Adds a wb-resource.
    `void` | `setClassesDeployPath(String classesDeployPath)`
    `void` | `setContextPath(String contextPath)`
    `void` | `setDeployName(String deployName)`
    `void` | `setLibConfigurations(Set<Configuration> libConfigurations)`
    `void` | `setLibDeployPath(String libDeployPath)`
    `void` | `setMinusConfigurations(Set<Configuration> minusConfigurations)`
    `void` | `setPathVariables(Map<String, File> pathVariables)`
    `void` | `setPlusConfigurations(Set<Configuration> plusConfigurations)` Synonym for setLibConfigurations(Set).
    `void` | `setProperties(List<WbProperty> properties)`
    `void` | `setResources(List<WbResource> resources)`
    `void` | `setRootConfigurations(Set<Configuration> rootConfigurations)`
    `void` | `setSourceDirs(Set<File> sourceDirs)`

  - ### 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#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), 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 EclipseWtpComponent(Project project, XmlFileContentMerger file)

  - ### Method Detail

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

      Enables advanced configuration like tinkering with the output XML or affecting the way existing wtp component file content is merged with gradle build information

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

      For example see docs for EclipseWtpComponent

    - #### public String getClassesDeployPath()

      The deploy path for classes.

      For examples see docs for EclipseWtp

    - #### public String getContextPath()

      The context path for the web application

      For examples see docs for EclipseWtp

    - #### public String getDeployName()

      The deploy name to be used.

      For examples see docs for EclipseWtp

    - #### public XmlFileContentMerger getFile()

      See file(Closure)

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

    - #### public Set<Configuration> getLibConfigurations()

      The configurations whose files are to be transformed into dependent-module elements with a deploy path of getLibDeployPath().

      For examples see docs for EclipseWtp

    - #### public String getLibDeployPath()

      The deploy path for libraries.

      For examples see docs for EclipseWtp

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

      The configurations whose files are to be excluded from dependent-module elements.

      For examples see docs for EclipseWtp

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

      The variables to be used for replacing absolute path in dependent-module elements.

      For examples see docs for EclipseModel

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

      Synonym for getLibConfigurations().

    - #### public Project getProject()

    - #### public List<WbProperty> getProperties()

      Additional property elements.

      For examples see docs for EclipseWtp

    - #### public List<WbResource> getResources()

      ConventionProperty for additional wb-resource elements.

      For examples see docs for EclipseWtp

      Only resources that link to an existing directory (WbResource.getSourcePath) will be added to the wtp component file. The reason is that non-existing resource directory declarations lead to errors when project is imported into Eclipse.

    - #### public Set<Configuration> getRootConfigurations()

      The configurations whose files are to be transformed into dependent-module elements with a deploy path of '/'.

      For examples see docs for EclipseWtp

    - #### public Set<File> getSourceDirs()

      ConventionProperty for the source directories to be transformed into wb-resource elements.

      For examples see docs for EclipseWtp

      Only source dirs that exist will be added to the wtp component file. Non-existing resource directory declarations lead to errors when project is imported into Eclipse.

    - #### public void mergeXmlComponent(WtpComponent xmlComponent)

    - #### public void property(Map<String, String> args)

      Adds a property.

      For examples see docs for EclipseWtp

      Parameters:
        `args` - A map that must contain a 'name' and 'value' key with corresponding values.

    - #### public void resource(Map<String, String> args)

      Adds a wb-resource.

      For examples see docs for EclipseWtp

      Parameters:
        `args` - A map that must contain a deployPath and sourcePath key with corresponding values.

    - #### public void setClassesDeployPath(String classesDeployPath)

    - #### public void setContextPath(String contextPath)

    - #### public void setDeployName(String deployName)

    - #### public void setLibConfigurations(Set<Configuration> libConfigurations)

    - #### public void setLibDeployPath(String libDeployPath)

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

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

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

      Synonym for setLibConfigurations(Set).

    - #### public void setProperties(List<WbProperty> properties)

    - #### public void setResources(List<WbResource> resources)

    - #### public void setRootConfigurations(Set<Configuration> rootConfigurations)

    - #### public void setSourceDirs(Set<File> sourceDirs)