My WAR file has about 30 MB of jars inside WEB-INF/lib.
It has become a major pain to deploy the WAR every time, as it takes up too much time to FTP it to remote machines.
I am looking for a way to move most of my jars from WEB-INF/lib to an external directory on the server machine, and reference this directory from my WAR.
I know one way of doing this is to include each jar's location individually in MAINFEST.MF. But it's too cumbersome as I have many jars, and it is prone to errors as the syntax requires lot of specific spaces, new lines etc.
Is there a way to refer to an external directory from the WAR for required jars?
In case of a jar being present at both the WEB-INF/lib and the external directory, it would be good if WEB-INF/lib takes precedence.
Also, I want the jars in the external directory to be accessible only to my WAR file, not for other WARs deployed on the same server. So I need a way to specify this external directory location at the application (WAR) level, I do not want to put the jars into shared lib folders or server lib folder, which in any case is a bad practice.
Is there any way to achieve this?
Edited by: user10677329 on Mar 22, 2013 4:39 AM
Edited by: user10677329 on Mar 22, 2013 4:40 AM
There's support for 'Shared Libraries' in JEE that you could use for this.
JBoss - modify jboss-service.xml (
Websphere - Admin console, add shared library and associate this library to the war/ear
Tomcat - catalina.properties
Tip - Use symlinks so that you can manage upgrades better