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.

Related Whitepaper:

Java Essential Training

Author David Gassner explores Java SE (Standard Edition), the language used to build mobile apps for Android devices, enterprise server applications, and more!

The course demonstrates how to install both Java and the Eclipse IDE and dives into the particulars of programming. The course also explains the fundamentals of Java, from creating simple variables, assigning values, and declaring methods to working with strings, arrays, and subclasses; reading and writing to text files; and implementing object oriented programming concepts. Exercise files are included with the course.

Get it Now!  

Examples Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
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.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books