EAR Module Configuration Question


I am trying to set up a new project which contains 3 modules, an EJB, a WEB, and an EAR. When creating the EAR module I see where I can specify to include the jar and the war file from the other two modules but I also need to add some jar files which will be in the top level of the ear and some other jar files which will be in a lib/ directory off the top level of my EAR. The jars are not created by the other modules they are support libraries. I do not see where to configure the EAR module to support this layout. Here is an example of the layout I would like to achieve.

jar tvf myEar.ear


So myEJBModule.jar & myWebModule.war should get packaged based on the EAR module's "Modules and Libraries to Package" settings which seem to automatically get populated based on the project's modules. Do I have to create a seperate project for these other libraries or is the another/better way to get them added in the structure I am looking for?



1 comment
Comment actions Permalink

OK after playing around with things a bit I think I am on the right track. In the EJB Module settings section of my EJB Module I added the jars I need for compilation and told it to package the ones I wanted for runtime by setting the "Packaging method" to "Link via manifest and copy files to" and setting the "Path Relative to Deployment Root" to the structure I was looking for in the EAR. Then in the "Java EE Build Settings" tab I checked off "Create EJB module jar file" and "Allow to copy a packaged files outside the exploded directory or jar". I am not sure if I need that option checked. I'll experiment further. Under the EJB Module's "Dependencies" tab I checked off the "Export" button next to the jars I wanted packaged. I'm not sure if this is necessary either since the other settings seemed to control packaging.

With those settings I auto generated the ant files for the Project (at this point the EJB jar and EAR) and built it. I was treated to an EJB jar with the correctly structured contents and an EAR also correctly structured.

I think what was initially confusing and lead to my post was that it was not entirely obvious to me that packaging of the EJB Module Settings would impact the deployment structure relative to the EAR root vs. its own jar root but I guess that makes sense since you wouldn't want a jar included in the EJB's jar.

Any insight on what "Allow to copy a packaged files outside the exploded directory or jar" and "Export" (on Dependencies tab) would be useful.



Please sign in to leave a comment.