api / org.gradle.plugins.ide.eclipse.model / EclipseWtpComponent

EclipseWtpComponent

open 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!

 apply plugin: 'war' //or 'ear' or 'java' 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. //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' } } } 
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: '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 } } } } } 

Constructors

<init>

EclipseWtpComponent(project: Project, file: XmlFileContentMerger)

Functions

file

open fun file(closure: Closure<Any>): Unit

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>): Unit

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

For example see docs for EclipseWtpComponent

getClassesDeployPath

open fun getClassesDeployPath(): String

The deploy path for classes.

For examples see docs for EclipseWtp

getContextPath

open fun getContextPath(): String

The context path for the web application

For examples see docs for EclipseWtp

getDeployName

open fun getDeployName(): String

The deploy name to be used.

For examples see docs for EclipseWtp

getFile

open fun getFile(): XmlFileContentMerger

See #file(Action)

getFileReferenceFactory

open fun getFileReferenceFactory(): FileReferenceFactory

getLibConfigurations

open fun getLibConfigurations(): MutableSet<Configuration>

The configurations whose files are to be marked to be deployed with a deploy path of #getLibDeployPath().

For examples see docs for EclipseWtp

getLibDeployPath

open fun getLibDeployPath(): String

The deploy path for libraries.

For examples see docs for EclipseWtp

getMinusConfigurations

open fun getMinusConfigurations(): MutableSet<Configuration>

The configurations whose files are to be excluded from wtp deployment.

For examples see docs for EclipseWtp

getPathVariables

open fun getPathVariables(): MutableMap<String, File>

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

For examples see docs for EclipseModel

getPlusConfigurations

open fun getPlusConfigurations(): MutableSet<Configuration>

Synonym for #getLibConfigurations().

getProject

open fun getProject(): Project

getProperties

open fun getProperties(): MutableList<WbProperty>

Additional property elements.

For examples see docs for EclipseWtp

getResources

open fun getResources(): MutableList<WbResource>

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.

getRootConfigurations

open fun getRootConfigurations(): MutableSet<Configuration>

The configurations whose files are to be marked to be deployed with a deploy path of '/'.

For examples see docs for EclipseWtp

getSourceDirs

open fun getSourceDirs(): MutableSet<File>

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.

mergeXmlComponent

open fun mergeXmlComponent(xmlComponent: WtpComponent): Unit

property

open fun property(args: MutableMap<String, String>): Unit

Adds a property.

For examples see docs for EclipseWtp

resource

open fun resource(args: MutableMap<String, String>): Unit

Adds a wb-resource.

For examples see docs for EclipseWtp

setClassesDeployPath

open fun setClassesDeployPath(classesDeployPath: String): Unit

setContextPath

open fun setContextPath(contextPath: String): Unit

setDeployName

open fun setDeployName(deployName: String): Unit

setLibConfigurations

open fun setLibConfigurations(libConfigurations: MutableSet<Configuration>): Unit

setLibDeployPath

open fun setLibDeployPath(libDeployPath: String): Unit

setMinusConfigurations

open fun setMinusConfigurations(minusConfigurations: MutableSet<Configuration>): Unit

setPathVariables

open fun setPathVariables(pathVariables: MutableMap<String, File>): Unit

setPlusConfigurations

open fun setPlusConfigurations(plusConfigurations: MutableSet<Configuration>): Unit

Synonym for #setLibConfigurations(Set).

setProperties

open fun setProperties(properties: MutableList<WbProperty>): Unit

setResources

open fun setResources(resources: MutableList<WbResource>): Unit

setRootConfigurations

open fun setRootConfigurations(rootConfigurations: MutableSet<Configuration>): Unit

setSourceDirs

open fun setSourceDirs(sourceDirs: MutableSet<File>): Unit