I am deploying an EAR with a utility jar, say A.jar located in the EAR's lib folder. My EAR's application.xml is:
<application ...>
<library-directory>lib</library-directory>
<module><ejb>cashflow-ejb.jar</ejb></module>
<module>
<web>
<web-uri>cashflow-war.war</web-uri>
<context-root>cashflow</context-root>
</web>
</module>
</application>
However, my WAR can't see the classes in the EAR's lib/A.jar and the deployment fails with a ClassNotFound exception. I went through these two similar posts: a and b, but none of the solutions offered there seemed to work. Basically I think I need the WAR's MANIFEST file to have a Class-Path: entry pointing to the EAR's lib. Can someone provide an ANT target for that? I've tried "../lib", as in:
<war
needxmlfile="false"
basedir="${webroot.dir}"
warfile="${build.dir}/${project.distname}.war">
<exclude name="WEB-INF/src/**"/>
<manifest>
<attribute name="Class-Path" value="../lib"/>
</manifest>
</war>
But it didn't seem to work and neither did "lib/A.jar", "../lib/A.jar" or "/lib" for the Class-Path value. The only solution that deploys in JBoss AS 7.1.1 is to copy A.jar both in the EAR's /lib location and in the WAR's WEB-INF/lib but then I have two copies of the same JAR in my EAR.