Java – How do tomcat download maven dependencies?

How do tomcat download maven dependencies?… here is a solution to the problem.

How do tomcat download maven dependencies?

I just started using Maven in one of my projects. I package my artifact as a war file that I will deploy to Tomcat. I’ve specified all dependencies (e.g. jackson-databind jar) in the pom.xml file


I can see all my dependecy jars in my eclipse classpath, making sure there are no compilation errors or anything.

After packaging my code into a war file, I tried to check its contents. I can see all my source files, but there is no trace of my dependencies in the war file.

I deployed war to a local Tomcat server and was able to test without errors.

My question is: how does Tomcat get the jars that my project depends on? Or does Tomcat read the pom of each war file.xml and download all dependencies?


Simply put, Maven follows the description in the pom file to find all the libraries you need to make your web application work. In fact, in good old times (!), all required libraries had to be manually searched and placed in the /lib folder for WebApp to work.

So, when you

run e.g. MVN Clean Install Maven does the job for you: find dependencies, find the correct jar files from the Mavin repository, download them (if needed), and then build your War, putting everything in the right place, so when .war is deployed in Tomcat’s webapps folder (and then unzipped by Tomcat itself), in When the webapp starts, the Java classloader does not report an error.

Sorry for the truly simplified example, but I hope this has been clarified.

Related Problems and Solutions