Eclipse Web App using Maven
|
|
|
Create a skeleton web application using Maven
Create a web app skeleton using the maven archetype plugin
A project with the following project's pom.xml-file should be created:
Create eclipse configuration files
The plugin actually can create WTP R7, 1.0, 1.5 and 2.0 configuration files.
What version of Eclipse does WTP work with?
| Eclipse Version | WTP Version |
|
WTP 1.0.x |
Eclipse 3.1.x |
|
WTP 1.5.x |
Eclipse 3.2�(a.k.a. Eclipse Callisto) |
|
WTP 2.0.x |
Eclipse 3.3 (a.k.a. Eclipse Europa) |
|
WTP 3.0.x |
Eclipse 3.4 (a.k.a. Eclipse Ganymede) |
|
WTP 3.1 |
Eclipse 3.5 (a.k.a. Eclipse Galileo) |
|
WTP 3.2 |
Eclipse 3.6 (a.k.a. Eclipse Helios). |
|
WTP 3.3 |
Eclipse 3.7/4.1 |
Eclipse�s �.classpath� and �.project� configuration files are created. And you will noticed a new �.setting� folder is created. Inside contains �org.eclipse.wst.common.component� and �org.eclipse.wst.common.project.facet.core.xml�, both files for WTP or Faces support in Eclipse.
The produced org.eclipse.wst.common.project.facet.core.xml should look like :
if you have declared a dependency to servlet-api the
jst.web version
will take the dependency version.
In the below example you will have a version 6.0 for your jst.web according to your dependency definition
The org.eclipse.wst.common.component file should look like
WTP support for version higher than 2.0
The support of wtp was removed from the plugin but you can still define your file settings manually using the additionalConfig parameter.
Let's imaging you have a webapp named
web
and you want to add a sub project called
subModule.
The webapp should run on Apache Geronimo
WTP requires three settings files :
- .settings/org.eclipse.wst.common.component
- .settings/org.eclipse.wst.common.project.facet.core.xml
Let's create the corresponding files in our Maven project
Component description
The file org.eclipse.wst.common.component defines the WTP name of the project, the various folders and eventually references to sub-projects.
The subModule project should be name subModule in your Eclipse Workspace.
The file should be located in your maven project structure as :
src\main\config\geronimo\org.eclipse.wst.common.component
Facet definition
Faceted Project Framework provides a powerful mechanism for extending the capabilities of the Web Tools Platform. Project facets are typically used as a way of adding functionality to a project. When a facet is added to the project it can perform any necessary setup actions such as copying resources, installing builders, adding natures, etc. Facets can also be used as markers for enabling user interface elements. In the following snippet we are using Apache Geronimo in version 3.0 and JSF
The file should be located in your maven project structure as :
src\main\config\geronimo\org.eclipse.wst.common.project.facet.core.xml
Eclipse Plugin configuration
We have create the files required to configure our WTP project. We can now update our Eclipse plugin configuration to copy the xml files define in the previous chapter at the right place in our Eclipse settings folder.
To update our ecllipse project you can execute the following Maven command :
Conclusion
Using the additionalConfig parameter is not as convenient as generating the setting files by the plugin but it gives you much more control on WTP to provide the settings file by yourself. You can also define plenty of additional configuration using the same principle.
Related articles
Tags: eclipse , artifactid , dependency , version , create , java-webapp , jst.web
Comments
please won't you mind updating it according the evolution of both maven (from 2 to 3) and eclipse (from Indigo a new version is about to come out) ?
so the next I visit your post, you'll be current. Thanks you
The support of WTP was removed from the plugin but you can specify the faces configuration files using the configuration/additionalConfi g tags. I will add this procedure in the document
Meaning each time I need to import an EJB project into eclipse (without m2e) I'll need to manually set the facets?
RSS feed for comments to this post