Class EclipseWtpComponent
- java.lang.Object
-
- org.gradle.plugins.ide.eclipse.model.EclipseWtpComponent
-
public abstract class EclipseWtpComponent extends java.lang.ObjectEnables fine-tuning wtp component details of the Eclipse pluginExample 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
WtpComponentobjectExamples 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 withWtpComponenthere } //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 theWtpComponenthere } } } } }
-
-
Constructor Summary
Constructors Constructor Description EclipseWtpComponent(Project project, XmlFileContentMerger file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfile(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 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.java.lang.StringgetClassesDeployPath()The deploy path for classes.java.lang.StringgetContextPath()The context path for the web applicationjava.lang.StringgetDeployName()The deploy name to be used.XmlFileContentMergergetFile()Seefile(Action)org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactorygetFileReferenceFactory()java.util.Set<Configuration>getLibConfigurations()The configurations whose files are to be marked to be deployed with a deploy path ofgetLibDeployPath().java.lang.StringgetLibDeployPath()The deploy path for libraries.java.util.Set<Configuration>getMinusConfigurations()The configurations whose files are to be excluded from wtp deployment.java.util.Map<java.lang.String,java.io.File>getPathVariables()The variables to be used for replacing absolute path in dependent-module elements.java.util.Set<Configuration>getPlusConfigurations()Synonym forgetLibConfigurations().ProjectgetProject()java.util.List<WbProperty>getProperties()Additional property elements.java.util.List<WbResource>getResources()Additional wb-resource elements.java.util.Set<Configuration>getRootConfigurations()The configurations whose files are to be marked to be deployed with a deploy path of '/'.java.util.Set<java.io.File>getSourceDirs()Source directories to be transformed into wb-resource elements.voidmergeXmlComponent(WtpComponent xmlComponent)voidproperty(java.util.Map<java.lang.String,java.lang.String> args)Adds a property.voidresource(java.util.Map<java.lang.String,java.lang.String> args)Adds a wb-resource.voidsetClassesDeployPath(java.lang.String classesDeployPath)voidsetContextPath(java.lang.String contextPath)voidsetDeployName(java.lang.String deployName)voidsetLibConfigurations(java.util.Set<Configuration> libConfigurations)voidsetLibDeployPath(java.lang.String libDeployPath)voidsetMinusConfigurations(java.util.Set<Configuration> minusConfigurations)voidsetPathVariables(java.util.Map<java.lang.String,java.io.File> pathVariables)voidsetPlusConfigurations(java.util.Set<Configuration> plusConfigurations)Synonym forsetLibConfigurations(Set).voidsetProperties(java.util.List<WbProperty> properties)voidsetResources(java.util.List<WbResource> resources)voidsetRootConfigurations(java.util.Set<Configuration> rootConfigurations)voidsetSourceDirs(java.util.Set<java.io.File> sourceDirs)
-
-
-
Constructor Detail
-
EclipseWtpComponent
@Inject public EclipseWtpComponent(Project project, XmlFileContentMerger file)
-
-
Method Detail
-
getProject
public Project getProject()
-
getFile
public XmlFileContentMerger getFile()
Seefile(Action)
-
file
public void file(@DelegatesTo(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 informationThe object passed to whenMerged{} and beforeMerged{} closures is of type
WtpComponentFor example see docs for
EclipseWtpComponent
-
file
public void file(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.For example see docs for
EclipseWtpComponent- Since:
- 3.5
-
getSourceDirs
public java.util.Set<java.io.File> getSourceDirs()
Source 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
public void setSourceDirs(java.util.Set<java.io.File> sourceDirs)
-
getRootConfigurations
public java.util.Set<Configuration> getRootConfigurations()
The configurations whose files are to be marked to be deployed with a deploy path of '/'.For examples see docs for
EclipseWtp
-
setRootConfigurations
public void setRootConfigurations(java.util.Set<Configuration> rootConfigurations)
-
getLibConfigurations
public java.util.Set<Configuration> getLibConfigurations()
The configurations whose files are to be marked to be deployed with a deploy path ofgetLibDeployPath().For examples see docs for
EclipseWtp
-
setLibConfigurations
public void setLibConfigurations(java.util.Set<Configuration> libConfigurations)
-
getPlusConfigurations
public java.util.Set<Configuration> getPlusConfigurations()
Synonym forgetLibConfigurations().
-
setPlusConfigurations
public void setPlusConfigurations(java.util.Set<Configuration> plusConfigurations)
Synonym forsetLibConfigurations(Set).
-
getMinusConfigurations
public java.util.Set<Configuration> getMinusConfigurations()
The configurations whose files are to be excluded from wtp deployment.For examples see docs for
EclipseWtp
-
setMinusConfigurations
public void setMinusConfigurations(java.util.Set<Configuration> minusConfigurations)
-
getDeployName
public java.lang.String getDeployName()
The deploy name to be used.For examples see docs for
EclipseWtp
-
setDeployName
public void setDeployName(java.lang.String deployName)
-
getResources
public java.util.List<WbResource> getResources()
Additional 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
public void setResources(java.util.List<WbResource> resources)
-
resource
public void resource(java.util.Map<java.lang.String,java.lang.String> 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.
-
getProperties
public java.util.List<WbProperty> getProperties()
Additional property elements.For examples see docs for
EclipseWtp
-
setProperties
public void setProperties(java.util.List<WbProperty> properties)
-
property
public void property(java.util.Map<java.lang.String,java.lang.String> 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.
-
getContextPath
public java.lang.String getContextPath()
The context path for the web applicationFor examples see docs for
EclipseWtp
-
setContextPath
public void setContextPath(java.lang.String contextPath)
-
getClassesDeployPath
public java.lang.String getClassesDeployPath()
The deploy path for classes.For examples see docs for
EclipseWtp
-
setClassesDeployPath
public void setClassesDeployPath(java.lang.String classesDeployPath)
-
getLibDeployPath
public java.lang.String getLibDeployPath()
The deploy path for libraries.For examples see docs for
EclipseWtp
-
setLibDeployPath
public void setLibDeployPath(java.lang.String libDeployPath)
-
getPathVariables
public java.util.Map<java.lang.String,java.io.File> getPathVariables()
The variables to be used for replacing absolute path in dependent-module elements.For examples see docs for
EclipseModel
-
setPathVariables
public void setPathVariables(java.util.Map<java.lang.String,java.io.File> pathVariables)
-
getFileReferenceFactory
public org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory getFileReferenceFactory()
-
mergeXmlComponent
public void mergeXmlComponent(WtpComponent xmlComponent)
-
-