Importing an enterprise application EAR file

Enterprise application projects are deployed into EAR files. You can import an enterprise application project by importing it from a deployed EAR file.

If the EAR file contains project meta-data (the EAR was exported with the Include project build paths and meta-data files option selected) you can import it with the Import for partial EAR development option. This option imports the selected modules and utility JAR files as binary projects. This option is especially useful if you are importing into a workspace where some projects are in binary form and others are attached to a repository.

You can also choose to import utility JAR files as utility Java projects. You can also use the wizard to change the new project names for the EAR file and modules that will be imported.

The following paragraph applies for Windows You can quickly drag and drop an enterprise application EAR file from the Windows Explorer or desktop to the Project Explorer view. The Import wizard will open with appropriate fields already populated.

This process for importing an EAR file is not meant to be a project sharing mechanism. If you want to share projects, see Sharing projects using Project Interchange.

To import an EAR file using the wizard:

  1. In the J2EE perspective, click File > Import > EAR file, then click Next. The Import wizard opens.

  2. Specify the following general options for the EAR import:

    1. EAR file: Enter the full path for the EAR file that you want to import. You can click Browse to select the EAR file from the file system.

    2. EAR project: type a name for the enterprise application project that will be created when you import the EAR file.

    3. Import EAR project: Select this option to import the actual EAR project contained in the EAR file. Otherwise, the wizard simply imports the modules and other resources contained in the EAR file and adds them to the specified project.

    4. Overwrite existing resources without warning: Select this option if you do not want to be warned about overwriting existing resources.

    5. Delete project on overwrite: If you are overwriting resources, you can select this option to create a new project rather than overwrite each file.

    6. Target server: Select the application server that you want to target for your development. This selection affects the runtime settings by modifying the class path entries for the project.

  3. Click Next, and complete the following steps:

    1. Allow nested project overwrites (modules and utility projects): Select this option if you are importing to an existing project and want to overwrite existing nested projects.

    2. Import for partial EAR development: If the EAR file you are importing was exported with build paths and meta-data files included, selecting this option will import the selected modules and utility JAR files as binary projects.

    3. Select the utility JAR files that you want to be imported as utility Java projects. If you select the Import for partial EAR development option, all utility JAR files and Web libraries are selected by default. Otherwise, you can choose specific utility JAR files and Web libraries to import as projects. The utility JAR files that are not selected will be imported as utility JAR files in the EAR. The Web libraries that you do not select will be imported as Web Libraries into the corresponding Web project.

    4. In the Module Root Location field, specify the root directory for all of the projects that will be imported or created during import.

  4. Click Next.

  5. On the EAR Module and Utility JAR Projects page of the wizard, select the projects that you want to import with the EAR file. Also, you can edit the new project name for each module and utility project to be imported.
    Tip: The selection buttons on this page can help you select the projects to import when you are importing for partial EAR development. For example, if you are importing to a workspace where some projects are attached to a repository and other projects are in binary form, these buttons help you make the proper selections for which projects to import:

    • Select New: Selects the projects that are currently not in your workspace.

    • Select Binary: Selects the modules and projects that currently exist in the workspace in binary form. This can help you avoid overwriting your non-binary projects that are attached to a repository.

    • Select All: Selects all projects for import.

    • Deselect All: Clears all module and utility projects for import.

  6. Click Finish to import the contents of the EAR file.

 

Related concepts

J2EE architecture
Enterprise application projects
Application Deployment Descriptor editor
Cyclical dependencies between J2EE modules

 

Related tasks

Creating an enterprise application project
Exporting an enterprise application into an EAR file
Correcting cyclical dependencies after an EAR is imported
Specifying dependent JAR files or modules