JDev 11g: Packaging Libraries at EAR Level
By Olaf Heimburger on Oct 31, 2008
Many users have problems to use their libraries in their applications. But sometimes a working solution is too obvious to be noticed.
To include all the libraries you need for your project in an EAR file:
- Create a package project called common-libs and put all the libraries in a directory included in the Project Source Path. Don't use the src directory but lib at the same hierarchy level. Add this new directory to the Project Source Paths.
- Open the Application Properties
- Create a deployment profile for the EAR file.
- To include the libraries within the EAR file we have two options to include the libraries are available: either put into APP-INF/lib or a directory of your choice (eg. lib). In the Deployment Profile select Application Assembly, tick the check box of every JAR file you need and enter the directory name (APP-INF/lib or lib) in the Path in EAR text field at the bottom. This must be done for every JAR file!
- If you do not want to use APP_INF/lib you need to create an application.xml for the application. Open the Application Resources accordion and expand Descriptors and META-INF to see which Deployment Descriptors are available. On Descriptors, chose New JEE Deployment Descriptor... from the Context Menu and select application.xml. In the newly created application.xml insert the tag <library-directory>lib</library-directory>.
- From the Application Menu select Deploy to EAR File to check the contents before deploying it to the server.