deploy war file without lib in Tomcat
At this post I'd talk about how to decrease size of big war files and make deployment faster.
I have a 15 MB war file and the size of lib (jar files) directory is 14.8 MB! So I need a solution that enables me to upload my project lib directory just for once and after that deploy my war file without lib directory.
At first I renamed my lib directory to myprojlib and then copied (for example using ftp) it to ${tomcat home}/common/lib folder on the server.
After that I modify catalina.properties file in ${tomcat home}/conf and add my myprojlib path to common.loader according below:
common.loader=${catalina.home}/common/classes,Now save the file and restart my Tomcat.
${catalina.home}/common/i18n/*.jar,
${catalina.home}/common/endorsed/*.jar,
${catalina.home}/common/lib/*.jar,
${catalina.home}/common/lib/myprojlib/*.jar
After that I remove lib folder from my project and compile it without lib directory. Be careful don't package jar files in your project. My war file is
180KB now and I deploy it easily and I shouldn’t deploy 15 MB war file every time.

2 Comments:
Thx for this very useful tip. Saved my day .
Hi! Thanks.
It's really a good tip!
Post a Comment
<< Home