We a fairly large Java project that contains multiple utility projects and web projects. We also use several utility jars such as Log4J, Spring and Hibernate. IBM has an great article on how to organize utility jars. Here is what we do:
- Create a java project to hold all the utility Jars. We would like to create a folder for each vendor. However, a limitation of Linked Utility Jars forced us to place all the jars in the root of the project directory. We also export all the jars in the project build path.
- In all projects that use the jars, we simply include the project in the build path. Since the project that hold the utility jars export them, these jars are automatically used by the projects that reference the utility project.
- Create a path variable that points to the utility project. In all EAR projects, reference the jars in the utility project through Linked Utility Jars (Import J2EE Utility Jars). When we export the EAR, all the linked jars will be included in the root of EAR.
- In the web projects, edit META-INF\MANIFEST.MF file using the Jar dependency editor to include jars. This is necessary for the web project to use the jars in the EAR file.