|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectorg.gradle.plugins.ide.eclipse.model.EclipseWtpComponent
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 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 } } } } }
Property Summary | |
---|---|
String |
classesDeployPath
The deploy path for classes. |
String |
contextPath
The context path for the web application |
String |
deployName
The deploy name to be used. |
XmlFileContentMerger |
file
See file(Closure) |
Set |
libConfigurations
The configurations whose files are to be transformed into dependent-module elements with a deploy path of #libDeployPath. |
String |
libDeployPath
The deploy path for libraries. |
Set |
minusConfigurations
The configurations whose files are to be excluded from dependent-module elements. |
Map |
pathVariables
The variables to be used for replacing absolute path in dependent-module elements. |
org |
project
|
List |
properties
Additional property elements. |
List |
resources
ConventionProperty for additional wb-resource elements. |
Set |
rootConfigurations
The configurations whose files are to be transformed into dependent-module elements with a deploy path of '/'. |
Set |
sourceDirs
ConventionProperty for the source directories to be transformed into wb-resource elements. |
Constructor Summary | |
EclipseWtpComponent(Project project, XmlFileContentMerger file)
|
Method Summary | |
---|---|
void
|
file(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 |
FileReferenceFactory
|
getFileReferenceFactory()
|
Set
|
getPlusConfigurations()
Synonym for libConfigurations. |
void
|
mergeXmlComponent(WtpComponent xmlComponent)
|
void
|
property(Map args)
Adds a property. |
void
|
resource(Map args)
Adds a wb-resource. |
void
|
setPlusConfigurations(Set plusConfigurations)
|
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Property Detail |
---|
String classesDeployPath
For examples see docs for EclipseWtp
String contextPath
For examples see docs for EclipseWtp
String deployName
For examples see docs for EclipseWtp
final XmlFileContentMerger file
Set libConfigurations
For examples see docs for EclipseWtp
String libDeployPath
For examples see docs for EclipseWtp
Set minusConfigurations
For examples see docs for EclipseWtp
Map pathVariables
For examples see docs for EclipseModel
final org project
List properties
For examples see docs for EclipseWtp
List resources
For examples see docs for EclipseWtp
Only resources that link to an existing directory (WbResource#sourcePath) 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.
Set rootConfigurations
For examples see docs for EclipseWtp
Set sourceDirs
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.
Constructor Detail |
---|
EclipseWtpComponent(Project project, XmlFileContentMerger file)
Method Detail |
---|
void file(Closure closure)
The object passed to whenMerged{} and beforeMerged{} closures is of type WtpComponent
For example see docs for EclipseWtpComponent
FileReferenceFactory getFileReferenceFactory()
Set getPlusConfigurations()
void mergeXmlComponent(WtpComponent xmlComponent)
void property(Map args)
For examples see docs for EclipseWtp
args
- A map that must contain a 'name' and 'value' key with corresponding values.
void resource(Map args)
For examples see docs for EclipseWtp
args
- A map that must contain a deployPath and sourcePath key with corresponding values.
void setPlusConfigurations(Set plusConfigurations)
Gradle API 1.12