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.
- Add required projects and classpath variables to the Java™ Build Path and Project References.
- In the Project Explorer view, right-click the portlet project and select
Properties.
- In the left pane, select
Java Build Path.
- Select the
Projects tab and check the boxes next to the required projects.
- Click OK
- In the left pane, select
Project References.
- 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.
- Click OK.
- If the required projects are EJB projects, follow these steps:
- Add all required projects to the portlet project's EAR project for the portlet project.
- In the Project Explorer view, expand the EAR project.
- Double-click the EAR Deployment Descriptor to open its editor.
- Select the
Module tab.
- In the Modules section, click
Add to add a project to use.
- Click Finish.
- In the Project Utility JAR section, click
Add to map utility JAR files to Java projects for the portlet project.
- Press
Ctrl + S to save the data.
- Click OK if the Repair Server Configuration dialog box appears.
- Add all required projects to the server:
- In the Servers view, right-click the server and select
Add and remove projects.
- Remove unneeded projects from the Configured projects list box using the
Remove or
Remove All buttons.
- Move the appropriate projects from the
Available projects list to the
Configured projects list using the
Add or
Add All buttons.
- Click Finish.