I have a 'Utilty Project', and an 'EAR Project' that includes that 'Utility Project'. All the classes from the 'Utility Project' end up being packaged as a JAR and placed within the 'lib' directory of the exported EAR, for example:
EAR.ear
META-INF
MANIFEST.MF
lib
utility.jar (which expands to):
META-INF
MANIFEST.MF
com
acme
Foo.class
Bar.class
However, the 'Utility Project' relies on a library (freemarker.jar) that has been added to the build path using 'Properties > Java Build Path > Libraries'. All I want to do is to get freemarker.jar added to the EAR as follows:
EAR.ear
META-INF
MANIFEST.MF
lib
**freemarker.jar**
utility.jar (which expands to):
META-INF
MANIFEST.MF
com
acme
Foo.class
Bar.class
By searching around within Eclipse I've found 4 potential avenues for achieving this, none of which have worked. If someone can just cut to the chase and tell me what I should actually do, that would be great. But just in case, I'll iterate them here:
From the 'Utility Project' Properties:
- If I click 'Java Build Path > Order and Export' and select 'freemarker.jar' for export, the jar does not end up in the EAR file at all.
- If I click 'Java EE Module Dependencies' and select the 'freemarker.jar' library as a dependency, it says:
This JAR is a bundled library of an EAR project and is supposed to be packed in the EAR's library directory. It conflicts with the manifest class path dependency you are trying to create. If you create this dependency, the JAR will be packed in the root (not library) directory of the EAR. Are you sure you want to proceed?
From the 'EAR Project' Properties:
- If I click 'Java EE Module Dependencies > Add JARs...' and navigate to the 'freemarker.jar', and make it a dependency, it gets added to the root of the EAR: /freemarker.jar
- If I do the same as above, but check the 'In Lib Dir' checkbox, it gets added into the lib folder, but contained within another lib folder: /lib/lib/freemarker.jar
Thanks.