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 EclipseWtpComponent

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

    class EclipseWtpComponent
    extends java.lang.Object

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.
           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':
           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
             }
           }
         }
       }
     }

@author: Szczepan Faber, created at: 4/20/11

Property Summary
`java.lang.String` | `classesDeployPath` The deploy path for classes.
`java.lang.String` | `contextPath` The context path for the web application For examples see docs for EclipseWtp
`java.lang.String` | `deployName` The deploy name to be used.
`XmlFileContentMerger` | `file` See file(Closure)
`java.util.Set` | `libConfigurations` The configurations whose files are to be transformed into dependent-module elements with a deploy path of #libDeployPath.
`java.lang.String` | `libDeployPath` The deploy path for libraries.
`java.util.Set` | `minusConfigurations` The configurations whose files are to be excluded from dependent-module elements.
`java.util.Map` | `pathVariables` The variables to be used for replacing absolute path in dependent-module elements.
`java.lang.Object` | `project`
`java.util.List` | `properties` Additional property elements.
`java.util.List` | `resources` ConventionProperty for additional wb-resource elements.
`java.util.Set` | `rootConfigurations` The configurations whose files are to be transformed into dependent-module elements with a deploy path of '/'.
`java.util.Set` | `sourceDirs` ConventionProperty for the source directories to be transformed into wb-resource elements.

Constructor Summary
`EclipseWtpComponent(java.lang.Object project, XmlFileContentMerger file)`

Method Summary
`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
`org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory` | `getFileReferenceFactory()`
`java.util.Set` | `getPlusConfigurations()` Synonym for libConfigurations.
`void` | `mergeXmlComponent(WtpComponent xmlComponent)`
`void` | `property(java.util.Map args)` Adds a property.
`void` | `resource(java.util.Map args)` Adds a wb-resource.
`void` | `setPlusConfigurations(java.util.Set plusConfigurations)`

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

### classesDeployPath

    java.lang.String classesDeployPath

  The deploy path for classes.

  For examples see docs for EclipseWtp

### contextPath

    java.lang.String contextPath

  The context path for the web application

  For examples see docs for EclipseWtp

### deployName

    java.lang.String deployName

  The deploy name to be used.

  For examples see docs for EclipseWtp

### file

    final XmlFileContentMerger file

  See file(Closure)

### libConfigurations

    java.util.Set libConfigurations

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

  For examples see docs for EclipseWtp

### libDeployPath

    java.lang.String libDeployPath

  The deploy path for libraries.

  For examples see docs for EclipseWtp

### minusConfigurations

    java.util.Set minusConfigurations

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

  For examples see docs for EclipseWtp

### pathVariables

    java.util.Map pathVariables

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

  For examples see docs for EclipseModel

### project

    final java.lang.Object project

### properties

    java.util.List properties

  Additional property elements.

  For examples see docs for EclipseWtp

### resources

    java.util.List resources

  ConventionProperty for additional wb-resource elements.

  For examples see docs for EclipseWtp

### rootConfigurations

    java.util.Set rootConfigurations

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

  For examples see docs for EclipseWtp

### sourceDirs

    java.util.Set sourceDirs

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

  For examples see docs for EclipseWtp

Constructor Detail

### EclipseWtpComponent

    EclipseWtpComponent(java.lang.Object project, XmlFileContentMerger file)

Method Detail

### file

    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

### getFileReferenceFactory

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

### getPlusConfigurations

    java.util.Set getPlusConfigurations()

  Synonym for libConfigurations.

### mergeXmlComponent

    void mergeXmlComponent(WtpComponent xmlComponent)

### property

    void property(java.util.Map 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.

### resource

    void resource(java.util.Map 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.

### setPlusConfigurations

    void setPlusConfigurations(java.util.Set plusConfigurations)

Groovy Documentation