Home

 

Creating a new project

Development on a new application is usually started by creating one or more projects. You should plan the projects required beforehand, and then use relevant project wizards to create a skeleton set of projects for the application under construction. It is also possible to open existing projects if they are to be used as part of the current application.

As an example of the new project creation process, the following instructions demonstrate the New Enterprise Application wizard:

To launch this wizard, select File Æ New Æ Project.

Select Java EE Æ Enterprise Application Project and click Next. The New Project dialog with Enterprise Application Project selected is shown in.

Figure 5-3 New Project dialog with Enterprise Application Project selected

The first dialog of the Enterprise Application Project wizard is shown in Figure | -4.

Figure 5-4 New EAR Application Project: Create an EAR Application

On this dialog, you can specify:

Project Name-The project name, Example in this case.
Project contents-By default, projects are stored in a subdirectory that is created for the project in the workspace directory. Using this option, another location can be specified.
Target Runtime-An enterprise application project is targeted to run on an Application Server. This option allows the user to configure the target runtime environment.
EAR Version-An enterprise application can be created for a specific version of Java EE such as 1.4 or 5. In this case version 5 is selected from the drop down list.
Configuration-This drop-down provides a list of saved configurations that have been created for previous enterprise application projects. A configuration can include a specific set of features and available versions, and it is often a good idea to make sure that all similar projects use the same configuration. An existing configuration can be chosen or <custom> can be selected. When <custom> is selected the user has the opportunity to specify their own configuration. Clicking the Modify button allows a configuration to be modified.

If you click the Modify button, the Project Facets dialog is presented.

This dialog allows the user to customize which features and versions of a feature will be available in the new project. It is also possible to save the configuration so that it can be used for subsequent projects. This project facets page is also used when creating a new Web, EJB, and connector project, but the facet options available are applicable to the type of project being created.



Figure 5-5 New EAR Application Project: Project Facets

The final dialog gives the user the opportunity to select any other projects that are to be part of this new enterprise application. This dialog includes select boxes for all the Java, EJB, Web and Application Client projects in the current workspace, which, if selected, will be included in the project references for the new project.

Figure 5-6 New EAR Application Project: Configure enterprise application settings

In this dialog, you can specify:

Content Directory-This specifies the folder within the Enterprise Application project under which the contents will be stored. This can be left empty, meaning that all contents will be stored under the root directory.
New Module-This button provides the ability to automatically create empty projects referenced by the new Enterprise Application project. Clicking New Module displays the dialog shown in Figure | -7. Because the current workspace in this example does not contain any other projects, the existing modules list is empty. If other projects are available, they are listed and can be selected or deselected as required.
Generate Deployment Descriptor-Because the deployment descriptor file, application.xml, is optional, you can choose whether you want one included or not.

Figure 5-7 Create default Java EE module

Click Cancel if you decide not to create any default Java EE modules.
Select the boxes for the projects you want to create, change the names if desired, and click Finish.

Click Finish in the New EAR Application Project wizard, Configure enterprise application settings dialog, and the new project (and associated projects) are created.

If the project you have created is associated with a particular perspective, in this case with the Java EE perspective, but you currently have a different perspective selected, Rational Application Developer prompts to ask if you want to switch over to the relevant perspective.

Figure 5-8 Prompt to open relevant perspective

ibm.com/redbooks