Setting Java Project Dependency Properties
It is possible to set a configuration to package and merge the output of dependent Java projects into the deployment of an EJB project. Here you will learn to:
- Establish a Java project dependency
- Configure the deployment of dependent Java projects
This feature is available in MyEclipse.
Sometimes you have EJB applications that consist of an EJB Project and additional Java projects. Please note that if your EJB Project depends upon 3rd party JARs then you must use an Enterprise Application project to incorporate the EJB project and the 3rd party libraries into a single Enterprise Archive (EAR) deployment unit. To learn more about Enterprise Projects and EAR deployment see Developing Java EE Enterprise Applications.
Frequently, the code base of an EJB application might be partitioned between a primary MyEclipse EJB Project and one or more Java projects upon which the EJB project depends. Typically, the role of these dependent Java projects is to localize common or shared code that has other uses beyond that of the EJB project. MyEclipse can be configured to package and merge the output of dependent Java projects into the deployment of an EJB project.
Establishing a Java Project Dependency
A Java project dependency is defined through the EJB project’s Build Path properties.
- Right-click the EJB project, and select Properties.
- Select Java Build Path, and click the Projects tab.
See the image below for an example of establishing the Logging Java project as a dependent project of a project named firstejb. Doing this enables firstejb project source code to have access to the classes defined by the Logging Java project. Code completion, validation, and other tools are able to reference the Logging project resources.
Making the Logging Java project a dependent of the firstejb EJB Project
Configuring the Deployment of Dependent Java Projects
The MyEclipse Web project Deployment Service allows you to set all deployment assembly configuration in the project’s properties.
- Right-click the project and select Properties.
- Expand MyEclipse, select Deployment Assembly, and click Add.
- Select Project, and click Next.
MyEclipse default dependent Java project deployment preferences
- Select a Java dependency project, and click Finish.
Including a dependent project in the deployment assembly