Sotirios-Efstathios Maneas

About Sotirios-Efstathios Maneas

Sotirios-Efstathios (Stathis) Maneas is a postgraduate student at the Department of Informatics and Telecommunications of The National and Kapodistrian University of Athens. His main interests include distributed systems, web crawling, model checking, operating systems, programming languages and web applications.

Troubleshooting: Maven Dependency libraries not deployed in Eclipse IDE

A Java Web project may contain build dependencies to external libraries, specified inside the pom.xml file. In this tutorial, we will show you how to deploy all these libraries, along with the executable files of the project, using the Tomcat Server instance of the Eclipse IDE.

In this example, we use the following tools on a Windows 7 platform:

  • Apache Maven 3.1.1
  • Apache Tomcat 7
  • Eclipse Kepler Service Release 1
  • JDK 1.7

Please refer to this guide here, in order to verify that you know how to create a Java Web application project, using Apache Maven.

The dependencies of a Web project should be deployed inside the library folder of the Eclipse’s Tomcat Plugin, called WEB-INF/lib. However, the default .classpath file generated by Maven’s command

mvn eclipse:eclipse

is incomplete and must augmented with additional information. The default .classpath file is show below:


<?xml version="1.0" encoding="UTF-8"?>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

Also, if we take a closer look inside Tomcat’s Plugin folder, we will observe that the libraries are indeed not deployed. The default location of Tomcat’s folder is:


As shown below, there is no folder under the name “lib”, that contains all declared dependencies:

eclipse_metadata_plugins WM

1. Fix the problem through the Eclipse IDE

Inside the Eclipse IDE, we must locate our project. Then:

  • Right click on the project and select Properties.
  • Click on the Deployment Assembly in the left panel.
  • Click Add… on the upper right and then, select Archive via Path Variable.
  • Repeat Step c) for every dependency of the project.
  • Click Apply and finally, click OK.

If every step has been successfully executed, all dependencies of the project shall appear:


The updated .classpath file has been augmented with the attributes tag and has the following form:

<?xml version="1.0" encoding="UTF-8"?>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar">
      <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>

Important: You may need to delete the existing Tomcat Server instance from Eclipse’s Servers view and create a new Tomcat Server instance, in order for the applied changes to take effect.

2. Fix the problem through Terminal or Command Line

A simpler way to fix the aforementioned issue is by using the terminal (Linux or Mac) or the command prompt (Windows). We must navigate to the folder of our project and issue the following command:

mvn eclipse:eclipse -Dwtpversion=2.0

If the command is successfully executed, a new file called org.eclipse.wst.common.component will be created inside the .settings folder of the project, as shown below:


<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="2.0">
<wb-module deploy-name="DynamicServlet">
<property name="context-root" value="DynamicServlet"/>
<wb-resource deploy-path="/" source-path="src/main/webapp"/>
<wb-resource deploy-path="/" source-path="src/main/java"/>
<property name="java-output-path" value="/target/classes"/>
<dependent-module archiveName="javax.servlet-api-3.1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/var/M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar">
<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/>

3. Verify the deployment

If either of the proposed methods has been completed successfully, a new folder called lib will be created inside Tomcat’s Plugin folder, as shown below:

eclipse_metadata_plugins_updated WM

This was a tutorial on how to include and correctly deploy the dependencies of a Java Web project, using the Tomcat Server instance of the Eclipse IDE.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

and many more ....

Examples Java Code Geeks and all content copyright © 2010-2015, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Examples Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Examples Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.