Chapter 4. Projects

4.1. Faceted Projects Overview
4.2. Adding Facets to a Project
4.3. Relevant Resources Links

The most popular of the projects we deal with are the J2EE ones, such as Dynamic Web Project, EJB Project, or EAR project. Web projects of JBoss Tools are Struts, JSF and Seam projects. All of them are called faceted projects. Thus, in this chapter we are going to tell you about facets the main benefit of which to provide proper structuring and packaging for 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. Most often, these facets either add to the project's classpath, enable a builder, or watch the project in some other fashion. Generally, every project concerned has at least one facet when it's 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 undergone some criticism as 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. Apparently, 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.

In this section we're going to consider the facets added by JBoss Tools and show how you can configure them in a project: add new ones or modify already existing configuration of the facets.

One way to configure the facets is doing it while organizing a new project. To demonstrate this let's create a new Dynamic Web Project by selecting File > New > Other... and then Web > Dynamic Web Project.


Click Next and you will see Dynamic Web Project page like on the figure below.

The first page of most WTP projects allows you to target a specific runtime, representing a server's library location. It will also provide you the ability to add this project to an EAR project, and select a pre-selected default set of facets, called a configuration, rather than manually select each facet you might want.

Selecting the runtime, again, allows the project to install the proper classpaths to the project so it knows what code to compile against.


Click on the Modify button next to Configuration section in order to open the wizard which allows you to modify a chosen configuration. The wizard looks as follows.


Here 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

  • JBoss ESB

  • JBoss Portlets

  • JBoss Web Services

  • Seam

On this wizard page you can enable or disable any facet as well as change it version. What you should note here is that some facets or facets versions may conflict with each other. In case of incompatibility you'll be prompted about this in the combo box underneath.


When switching on the Runtimes <diffmk:wrapper> tab on the right you'll see the current server Runtime.</diffmk:wrapper>


On this tab you can also create a new Server Runtime and make it primary by pressing Make Primary button after enabling it.

Clicking on OK will save the chosen configuration of the facets and return you to the Dynamic Web Project wizard. Further pages in the wizard are specific to either the project type or the facets selected.

If you need to configure the facets for the existing project, you should bring up the context menu for selected project and click Properties and then Project Facets. This will bring up the familiar Project Facets wizard, where you can create your own custom facets configuration.

More on the WTP facets you can read in the eclipse help.