Externalizing third party libraries in tomcat

Web applications we may work with  multiple modules  due to this  we need to include various dependencies, this results big war file size.Reducing war file size is very important for build and release process when application is big.Only way to reduce the war file size is externalize the third party libs used in the application because this is not going to change often.

In tomcat there is a way to externalize the third party libraries used in the application. We can put all these third party libraries in folder and these libraries are loaded by tomcat class loaders during run time.To configure go to tomcat/conf/catalina.properties and edit the property shared.loader to locate your third party jars.


Now we are done with first step next during our build we should not include these lib.Excluding third party libraries can be achieved using build configuration in maven settings.Click Here to know about maven settings
Here one point to be noted we cannot put all the third party libraries in external folder. Some of the libs are very important during start up of the application, due to class loading hierarchy we may have to include those libraries in classpath of the application.


Post a Comment

Powered by Blogger.