This page describes Maven integration with Eclipse WTP.
Supported features
Integration is using project configuration framework to read configuration from Maven pom.xml and configure Eclipse projects according to those settings.
Project configuration is done automatically when Creating Maven projects or when Importing Maven projects. It can be also invoked manually from the "Maven / Update Project Configuration" popup menu.
See WTP mini howto for an example of web project. Here is the list of the currently supported project types and Maven plugins read by WTP project configurator:
| Project Type | WTP Facets | Maven packaging | Maven plugin |
|---|---|---|---|
| utility | Java, Utility Module | jar | maven-compiler-plugin |
| web | Java, Dynamic Web Module | war | maven-war-plugin |
| ejb | Java, EJB module | ejb | maven-ejb-plugin |
| ear | EAR | ear | maven-ear-plugin |
maven-war-plugin
| Name | Type | Description | |
|---|---|---|---|
| |
warSourceDirectory | File | Single directory for extra files to include in the WAR. |
| |
cacheFile | File | The file containing the webapp structure cache. |
| |
outputDirectory | String | The directory for the generated WAR. |
| |
warName | String | The name of the generated WAR. |
| |
webappDirectory | File | The directory where the webapp is built. |
| |
workDirectory | File | Directory to unpack dependent WARs into if needed |
| |
archive | MavenArchiveConfiguration | The archive configuration to use. See Maven Archiver Reference. |
| |
archiveClasses | boolean | Whether a JAR file will be created for the classes in the webapp. Using this optional configuration parameter will make the generated classes to be archived into a jar file and the classes directory will then be excluded from the webapp. Default value is: false. |
| |
attachClasses | boolean | Whether classes (that is the content of the WEB-INF/classes directory) should be attached to the project. Default value is: false. |
| |
classesClassifier | String | The classifier to use for the attached classes artifact. Default value is: classes. |
| |
classifier | String | Classifier to add to the artifact generated. If given, the artifact will be an attachment instead. |
| |
containerConfigXML | File | The path to the context.xml file to use. |
| |
dependentWarExcludes | String | Deprecated. use the excludes in the overlay object instead |
| |
dependentWarIncludes | String | Deprecated. use the includes in the overlay object instead |
| |
escapedBackslashesInFilePath | boolean | To escape interpolated value with windows path c:\foo\bar will be replace with c\: foo bar Default value is: false. |
| |
failOnMissingWebXml | boolean | Whether or not to fail the build is the web.xml file is missing. Set to false if you want you war built without a web.xml file. Default value is: true. |
| |
filteringDeploymentDescriptors | boolean | To filtering deployment descriptors disabled by default Default value is: false. |
| |
filters | List | Filters (property files) to include during the interpolation of the pom.xml. |
| |
nonFilteredFileExtensions | List | A list of file extensions to not filtering. will be used for webResources and overlay filtering |
| |
outputFileNameMapping | String | The file name mapping to use to copy libraries and tlds. If no file mapping is set (default) the file is copied with its standard name. |
| |
overlays | List | The overlays to apply. |
| |
packagingExcludes | String | The comma separated list of tokens to exclude from the WAR before packaging. This option may be used to implement the skinny war use case. |
| |
primaryArtifact | boolean | Whether this is the main artifact being built. Set tofalse if you don't want to install or deploy it to the local repository instead of the default one in an execution. Default value is: true. |
| |
useCache | boolean | Whether the cache should be used to save the status of the webapp accross multiple runs. Default value is: true. |
| |
warSourceExcludes | String | The comma separated list of tokens to exclude when copying content of the warSourceDirectory. |
| |
warSourceIncludes | String | The comma separated list of tokens to include when copying content of the warSourceDirectory. Default is '**'. |
| |
webResources | Resource[] | The list of webResources we want to transfer. |
| |
webXml | File | The path to the web.xml file to use. |
maven-ejb-plugin
| Name | Type | Description | |
|---|---|---|---|
| |
ejbVersion | String | What EJB version should the ejb-plugin generate? ejbVersion can be "2.x" or "3.x" (where x is a digit), defaulting to "2.1". When ejbVersion is "3.x", the ejb-jar.xml file is optional. Usage:<ejbVersion>3.0</ejbVersion> Default value is 2.1. |
| |
jarName | String | The name of the EJB file to generate. |
| |
outputDirectory | String | Directory that resources are copied to during the build. |
| |
archive | MavenArchiveConfiguration | The maven archiver to use. |
| |
classifier | String | Classifier to add to the artifact generated. If given, the artifact will be an attachment instead. |
| |
clientExcludes | List | Excludes. Usage:<clientIncludes> <clientInclude>**/*Ejb.class</clientInclude> <clientInclude>**/*Bean.class</clientInclude> </clientIncludes> Attribute is used only if client jar is generated. Default exclusions: **/Bean.class, */CMP.class, */Session.class, */package.html |
| |
clientIncludes | List | Includes. Usage:<clientIncludes> <clientInclude>*/</clientInclude> </clientIncludes> Attribute is used only if client jar is generated. Default value: */* |
| |
generateClient | String | Whether the ejb client jar should be generated or not. Default is false. |
maven-ear-plugin
| Name | Type | Description | |
|---|---|---|---|
| |
version | String | The version of the application.xml to generate. Valid values are 1.3, 1.4 and 5. |
| |
earSourceDirectory | File | Single directory for extra files to include in the EAR. |
| |
fileNameMapping | String | The file name mapping to use for all dependencies included in the EAR file. | |
| |
defaultLibBundleDir | String | The default bundle dir for libraries. |
| |
modules | EarModule[] | The ear modules configuration. |
| |
finalName | String | The name of the EAR file to generate. |
| |
outputDirectory | String | The directory for the generated EAR. |
| |
applicationXml | String | The location of a custom application.xml file to be used within the ear file. |
| |
archive | MavenArchiveConfiguration | The maven archiver to use. |
| |
archiverManager | ArchiverManager | The archive manager. |
| |
classifier | String | Classifier to add to the artifact generated. If given, the artifact will be an attachment instead. |
| |
earSourceExcludes | String | The comma separated list of tokens to exclude from the EAR. |
| |
earSourceIncludes | String | The comma separated list of tokens to include in the EAR. Default is '**'. |
| |
manifestFile | File | The location of the manifest file to be used within the ear file. |
| |
projectHelper | MavenProjectHelper | No description. |
| |
resourcesDir | File | The directory to get the resources from. |
| |
unpackTypes | String | The comma separated list of artifact's type(s) to unpack by default. |
| |
workDirectory | File | Directory that resources are copied to during the build. |
| |
artifactTypeMappings | PlexusConfiguration | The artifact type mappings. |
| |
description | String | Description of the application to be used when application.xml file is autogenerated. |
| |
displayName | String | Display name of the application to be used when application.xml file is autogenerated. |
| |
encoding | String | Character encoding for the auto-generated deployment file(s). |
| |
generateApplicationXml | Boolean | Whether the application.xml should be generated or not. |
| |
generatedDescriptorLocation | String | Directory where the deployment descriptor file(s) will be auto-generated. |
| |
jboss | PlexusConfiguration | The JBoss specific configuration. |
| |
mainArtifactId | String | The id to use to define the main artifact (e.g. the artifact without a classifier) when there is multiple candidates. |
| |
security | PlexusConfiguration | The security-roles to be added to the auto-generated application.xml file. |
Other ideas
- enable Maven support on Existing WTP project (transparently plug into "Maven / Enable Dependency Management" action)
- if pom.xml does not exist, use Eclipse configuration to generate pom.xml without changing project structure
- refactor vanilla WTP project into Maven project layout (could plug into the Eclipse refactorings)