Referring to other projects

When developing portlets, it is usually necessary to refer to other projects to access data objects, Web services, and other information to develop your portlets.

  1. Add required projects and classpath variables to the Java™ Build Path and Project References.

    1. In the Project Explorer view, right-click the portlet project and select

      Properties.

    2. In the left pane, select

      Java Build Path.

    3. Select the

      Projects tab and check the boxes next to the required projects.

    4. Click OK

    5. In the left pane, select

      Project References.

    6. Select the projects that are referenced by the other projects.

      Note: Indirect or nested project references are not supported. That is, if a portlet project references a Java project, and the Java project references a second Java project, the portlet project will not have access to the second Java project unless you also include the second Java project in the list of Project References.

    7. Click OK.

  2. If the required projects are EJB projects, follow these steps:

    1. Add all required projects to the portlet project's EAR project for the portlet project.

      1. In the Project Explorer view, expand the EAR project.

      2. Double-click the EAR Deployment Descriptor to open its editor.

      3. Select the

        Module tab.

      4. In the Modules section, click

        Add to add a project to use.

      5. Click Finish.

      6. In the Project Utility JAR section, click

        Add to map utility JAR files to Java projects for the portlet project.

      7. Press

        Ctrl + S to save the data.

      8. Click OK if the Repair Server Configuration dialog box appears.


    2. Add all required projects to the server:

      1. In the Servers view, right-click the server and select

        Add and remove projects.

      2. Remove unneeded projects from the Configured projects list box using the

        Remove or

        Remove All buttons.

      3. Move the appropriate projects from the

        Available projects list to the

        Configured projects list using the

        Add or

        Add All buttons.

      4. Click Finish.