# EclipseWtpComponent

abstract class 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 to configure them directly because Gradle configures it for free!

    plugins {
        id 'war' // or 'ear' or 'java'
        id '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.
          //non-existing source dirs won't be added to the component file.
          sourceDirs += file('someExtraFolder')

          // dependencies to mark as deployable with lib folder deploy path
          libConfigurations += [ configurations.someInterestingConfiguration ]

          // dependencies to mark as deployable with root folder deploy path
          rootConfigurations += [ configurations.someInterestingConfiguration ]

          // dependencies to exclude from wtp deployment
          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'
        }
      }
    }

Content copied to clipboard
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:

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

Content copied to clipboard

## Constructors

EclipseWtpComponent
Link copied to clipboard
@Inject
constructor(project: Project, file: XmlFileContentMerger)

## Properties

classesDeployPath
Link copied to clipboard
open var classesDeployPath: String
contextPath
Link copied to clipboard
open var contextPath: String
deployName
Link copied to clipboard
open var deployName: String
file
Link copied to clipboard
val file: XmlFileContentMerger
libConfigurations
Link copied to clipboard
open var libConfigurations: Set<Configuration>
libDeployPath
Link copied to clipboard
open var libDeployPath: String
minusConfigurations
Link copied to clipboard
open var minusConfigurations: Set<Configuration>
pathVariables
Link copied to clipboard
open var pathVariables: Map<String, File>
project
Link copied to clipboard
val project: Project
properties
Link copied to clipboard
open var properties: List<WbProperty>
resources
Link copied to clipboard
open var resources: List<WbResource>
rootConfigurations
Link copied to clipboard
open var rootConfigurations: Set<Configuration>
sourceDirs
Link copied to clipboard
open var sourceDirs: Set<File>

## Functions

file
Link copied to clipboard
open fun file(@DelegatesTo(value = XmlFileContentMerger::class) 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
open fun file(action: Action<in XmlFileContentMerger>)
Enables advanced configuration like tinkering with the output XML or affecting the way existing wtp component file content is merged with gradle build information.
getFileReferenceFactory
Link copied to clipboard
open fun getFileReferenceFactory(): FileReferenceFactory
getPlusConfigurations
Link copied to clipboard
open fun getPlusConfigurations(): Set<Configuration>
Synonym for getLibConfigurations.
mergeXmlComponent
Link copied to clipboard
open fun mergeXmlComponent(xmlComponent: WtpComponent)
property
Link copied to clipboard
open fun property(args: Map<String, String>)
Adds a property.
resource
Link copied to clipboard
open fun resource(args: Map<String, String>)
Adds a wb-resource.
setPlusConfigurations
Link copied to clipboard
open fun setPlusConfigurations(plusConfigurations: Set<Configuration>)
Synonym for setLibConfigurations.