Some users may have a need, when deploying an EAR project, to have dependent JARs or projects get packaged up and deployed along with the EAR itself. In these cases there are two things that need to happen, 1) the projects or JARs need to be included in the EAR deployment automatically and 2) the MANIFEST files for the dependent projects need to be updated to reflect the classpath references to the dependencies. Luckily MyEclipse will do both of these for you when you have your project setup correctly.
For your library project to be used properly by the EAR, please be sure you right-click on the EAR project and select Properties > Project References. Select the dependent java project you'd like to be packaged as a jar within the EAR. Then, select Properties > MyEclipse-EAR and ensure that the workbench settings include 'Jar dependent Java projecgts (See Notice) or that you override the workbench setting so that this is checked.
Now you need to ask MyEclipse to generate the Manifests by right-clicking on the EAR project and selecting MyEclipse > New module manifests. This will place updated manifests in the META-INF directories of each web and ejb project that have updated classpath entries for any jars you added in the first step. Whenever you change the number of dependent projects you'll need to regenerate the manifests.
And that is all, now when you deploy your EAR projects all the dependencies should be handled appropriately. |