Chapter 4. Deploying Modules

In this chapter it will be described how to deploy modules onto the server.

First of all it is necessary to say that deploying to a server is mostly painless. There are several ways to do it provided by WTP, and some additional methods provided by JBoss Tools. These methods are discribed further in this chapter

4.1. WTP Projects

4.1.1. Run On Server

The first WTP method is to right-click on a WTP project, such as a dynamic web project, ejb project, or ear project and then select Run As > Run on Server. The resulting dialog allows you to select which supporting server the project can be published to.

Define a New Server

Figure 4.1. Define a New Server


Click Next button to see add or remove projects page where you can choose projects to configure them on server.

Add or Remove Projects

Figure 4.2. Add or Remove Projects


For the JBoss AS Server Adapters, publishing using this method will force a default, best-guess, packaging configuration for your project. This best-guess does not publish incrementally, but instead repackages your entire project into a .war, .jar, or .ear as appropriate, and then copies that file into the proper deploy directory. For quicker smarter deployment, you will need to create archives using the Project Archives view and customize packaging yourself.

4.1.2. Add and Remove Projects

Another method is in either the Servers View, or the JBoss Servers View, to right click on a server and select the Add and Remove Projects menu item. This will bring up a dialog allowing you to either publish projects or modules to a server, or remove them from the server.

Add and Remove Projects

Figure 4.3. Add and Remove Projects


If the selected module is a WTP project, it will be published as in the Run on Server option, with a best-guess full package. If, however, the selected element is an archive from the Project Archives View, it will be published according to the rules of that module type.

4.1.3. JBoss Servers View, Publish

In the JBoss Server's View, in the bottom section, is a category called Modules which should display all currently-published modules on the server. By right-clicking on the desired module and selecting Full Publish, it will force a full rebuild of the entire module.

Full Publish

Figure 4.4. Full Publish


4.1.4. Project Archives View

In the Project Archives View, you can right-click on any declared archive and select the Publish To Server element, as described in the JBoss AS Perspective chapter.

Publish to Server

Figure 4.5. Publish to Server


The only way to ensure an Incremental Build, such as changes to one jsp, html, or .class file, is to enable the builder for that project. This is done by either changing the global preferences for the Archives View, or in enabling project-specific preferences and ensuring the builder is on.