JBoss.orgCommunity Documentation
The most popular of the projects we deal with are the J2EE ones, such as Dynamic Web Project, EJB Project, or EAR project. JBoss Tools™ web projects include Struts, JSF and Seam projects. These are referred to as faceted projects. This chapter will cover facets, which are used to provide a consistent structure and packaging features to any type of project.
The idea behind faceted projects is that each project can accept units of functionality, or facets, which can be added or removed by the user. These facets either add to the project's classpath, enable a builder, or watch the project in some other fashion. Typically every project concerned has at least one facet when it is created. As an example, a Web project has a WebDoclet facet, or an EJB Project has an EJB Module facet as prerequisites.
WTP projects have been criticized for being over-engineered or too restrictive in their design. WTP projects are set up in a tree-relationship to each other, where one project can be a child of another. For example, an EAR project may have a Web Project child, an EJB project child, or other types.
However, the benefit of this is that the structure of your projects is then known and packaging it up should be trivial. If your project is non-standard, or you feel too confined by such rigid structural requirements, you can still choose to package your project using the Archives plugin (see Section 3.2, “Project Archives View”).
This section will cover the facets added by JBoss Tools and show how you can configure them in a project by adding new ones or modifying existing facet configurations.
One way to configure the facets is doing it while organizing a new project. To demonstrate this create a new Dynamic Web Project by clicking on the Dynamic Web Project option in the Create Projects section of JBoss Central.
Click the
button and you will see a Dynamic Web Project page like on the figure below.The first page of most WTP projects allows you to target a specific runtime, which represents a server's library location. It will also provide you the ability to add this project to an EAR project and select a preselected default set of facets, called a configuration, rather than manually select each required facet.
Selecting the runtime allows the project to install the proper classpaths to the project so it knows what code to compile against.
Click the Configuration section to open a wizard which allows you to modify the chosen configuration. The wizard is shown in the image below.
button next to theHere part of the listed facets are those which are provided by WTP. Some of them are added by JBoss Tools. They are:
BIRT Charting Runtime Component
BIRT Reporting Runtime Component
CDI (Contexts and Dependency Injection)
CXF 2.x Web Services
JAX-RS (REST Web Services)
JAXB
JBoss Portlets
JBoss Web Services Core
JPA
Seam 2
On this wizard page you can enable or disable any facet as well as change its version. What you should note here is that some facets or facets versions may conflict with each other. In case of incompatibility you will be notified in the combobox underneath.
When switching on the Runtimes tab on the right you will see the current server Runtime.
On this tab you can also create a new Server Runtime and make it primary by enabling it and then clicking the
button.Clicking on the Figure 4.2, “New Dynamic Web Project”). Additional pages in the wizard are specific to either the project type or the facets selected.
button will save the chosen configuration of the facets and return you to the Dynamic Web Project wizard (seeIf you need to configure the facets for an existing project, right click on the project, select Project Facets. This will bring up the Project Facets wizard (see Figure 4.3, “Project Facets Wizard”), where you can create your own custom facets configuration.
and then selectMore information on the WTP facets can be found in the Eclipse help.