Class EclipseWtpComponent
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'
     }
   }
 }
 
 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
         }
       }
     }
   }
 }
 - 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidEnables advanced configuration like tinkering with the output XML or affecting the way existing wtp component file content is merged with gradle build informationvoidfile(Action<? super XmlFileContentMerger> action) 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 deploy path for classes.The context path for the web applicationThe deploy name to be used.getFile()Seefile(Action)org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactoryThe configurations whose files are to be marked to be deployed with a deploy path ofgetLibDeployPath().The deploy path for libraries.The configurations whose files are to be excluded from wtp deployment.The variables to be used for replacing absolute path in dependent-module elements.Synonym forgetLibConfigurations().Additional property elements.Additional wb-resource elements.The configurations whose files are to be marked to be deployed with a deploy path of '/'.Source directories to be transformed into wb-resource elements.voidmergeXmlComponent(WtpComponent xmlComponent) voidAdds a property.voidAdds a wb-resource.voidsetClassesDeployPath(String classesDeployPath) voidsetContextPath(String contextPath) voidsetDeployName(String deployName) voidsetLibConfigurations(Set<Configuration> libConfigurations) voidsetLibDeployPath(String libDeployPath) voidsetMinusConfigurations(Set<Configuration> minusConfigurations) voidsetPathVariables(Map<String, File> pathVariables) voidsetPlusConfigurations(Set<Configuration> plusConfigurations) Synonym forsetLibConfigurations(Set).voidsetProperties(List<WbProperty> properties) voidsetResources(List<WbResource> resources) voidsetRootConfigurations(Set<Configuration> rootConfigurations) voidsetSourceDirs(Set<File> sourceDirs) 
- 
Constructor Details- 
EclipseWtpComponent
 
- 
- 
Method Details- 
getProject
- 
getFileSeefile(Action)
- 
fileEnables advanced configuration like tinkering with the output XML or affecting the way existing wtp component file content is merged with gradle build informationThe object passed to whenMerged{} and beforeMerged{} closures is of type WtpComponentFor example see docs for EclipseWtpComponent
- 
fileEnables 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- Since:
- 3.5
 
- 
getSourceDirsSource directories to be transformed into wb-resource elements.For examples see docs for EclipseWtpOnly 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. 
- 
setSourceDirs
- 
getRootConfigurationsThe configurations whose files are to be marked to be deployed with a deploy path of '/'.For examples see docs for EclipseWtp
- 
setRootConfigurations
- 
getLibConfigurationsThe configurations whose files are to be marked to be deployed with a deploy path ofgetLibDeployPath().For examples see docs for EclipseWtp
- 
setLibConfigurations
- 
getPlusConfigurationsSynonym forgetLibConfigurations().
- 
setPlusConfigurationsSynonym forsetLibConfigurations(Set).
- 
getMinusConfigurationsThe configurations whose files are to be excluded from wtp deployment.For examples see docs for EclipseWtp
- 
setMinusConfigurations
- 
getDeployNameThe deploy name to be used.For examples see docs for EclipseWtp
- 
setDeployName
- 
getResourcesAdditional wb-resource elements.For examples see docs for EclipseWtpOnly 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.
- 
setResources
- 
resourceAdds a wb-resource.For examples see docs for EclipseWtp- Parameters:
- args- A map that must contain a deployPath and sourcePath key with corresponding values.
 
- 
getPropertiesAdditional property elements.For examples see docs for EclipseWtp
- 
setProperties
- 
propertyAdds a property.For examples see docs for EclipseWtp- Parameters:
- args- A map that must contain a 'name' and 'value' key with corresponding values.
 
- 
getContextPathThe context path for the web applicationFor examples see docs for EclipseWtp
- 
setContextPath
- 
getClassesDeployPathThe deploy path for classes.For examples see docs for EclipseWtp
- 
setClassesDeployPath
- 
getLibDeployPathThe deploy path for libraries.For examples see docs for EclipseWtp
- 
setLibDeployPath
- 
getPathVariablesThe variables to be used for replacing absolute path in dependent-module elements.For examples see docs for EclipseModel
- 
setPathVariables
- 
getFileReferenceFactorypublic org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory getFileReferenceFactory()
- 
mergeXmlComponent
 
-