Maven dependency libraries not deploy in Eclipse IDE
Problem
By default, while starting the Tomcat server instance in Eclipse, the project’s dependency libraries will not deploy to the Eclipse’s Tomcat plugin library folder ‘WEB-INF/lib’ correctly. See this “.classpath” file, that is generated by Maven “mvn eclipse:eclipse” command.
<classpath> <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/org/apache/struts/struts-core/1.3.10/struts-core-1.3.10.jar" /> <classpathentry kind="var" path="M2_REPO/org/apache/struts/struts-taglib/1.3.10/struts-taglib-1.3.10.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> </classpath>
See the following Tomcat plugin folder, obviously, the dependency libraries are not deploy.
$workspace_folder\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\StrutsExample

Solution
As i know, there are two solutions :
1. Java EE dependencies module
In Eclipse IDE, right click on the project, click properties and select the Java EE module dependencies and check all the project dependency libraries.

This will update the Eclipse’s classpath (.classpath) by adding corresponds “attributes” tag
<classpath> <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/org/apache/struts/struts-core/1.3.10/struts-core-1.3.10.jar" > <attributes> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="var" path="M2_REPO/org/apache/struts/struts-taglib/1.3.10/struts-taglib-1.3.10.jar" > <attributes> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> </classpath>
See the Tomcat plugin folder again, all dependency libraries are deployed to the “WEB-INF/lib” folder correctly.
$workspace_folder\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\StrutsExample

In Eclipse, you may need to delete the existing Tomcat server instant in the server tab, and create a new tomcat server instance to take effect.
2. WTP Support
Alternatively, you can issue the following command to make Maven support Eclipse WTP tool.
mvn eclipse:eclipse -Dwtpversion=2.0
The above command will generate a new file named “org.eclipse.wst.common.component” under project’s “.settings” folder.
<project-modules id="moduleCoreId" project-version="2.0"> <wb-module deploy-name="StrutsExample"> <property name="context-root" value="StrutsExample"/> <wb-resource deploy-path="/" source-path="src/main/webapp"/> <property name="java-output-path" value="/target/classes"/> <dependent-module archiveName="struts-core-1.3.10.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/var/M2_REPO/org/apache/struts/struts-core/1.3.10/struts-core-1.3.10.jar"> <dependency-type>uses</dependency-type> </dependent-module> <dependent-module archiveName="struts-taglib-1.3.10.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/var/M2_REPO/org/apache/struts/struts-taglib/1.3.10/struts-taglib-1.3.10.jar"> <dependency-type>uses</dependency-type> </dependent-module> <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/> </wb-module> </project-modules>
Now, start the server again, all dependency libraries will be deployed to the “WEB-INF/lib” folder automatically.







Hello :),
Thanks, very much for this work. It’s very helpful.
Best regards.
Mansour.
Thanks you saved me from insanity ……
I spent a week thinking of having done something wrong in my project ….
thanks a lot, a lot a lot!!! – you saved me! I’ve stuck into this blocker for an entire week suspecting that there is a problem with my GWT for Eclipse plugin… but answer is so simple! you are great, Man!
I also had the same problem ….
very very annoying
Thanks for the advice. For Eclipse Helios the option is “Deployment Assembly” in the project properties window. Then click Add button and next select Java Build Path Entries, then select Maven dependencies.
WOOT! Thanks for this!
Nice, nice, nice…
Tks a lot!!!
;-)
[...] http://www.mkyong.com/maven/maven-dependency-libraries-not-deploy-in-eclipse-ide/ [...]
I was looking for a solution to this problem and I could not find. And then you appeared under the following key words in Google:
“Eclipse tomcat deploy jar repository dependencies.”
Thank you very much, my friend. Postulate for president, man.
It’s glad to know that my sharing did help others :)
Thanks so much. I was stumped by this for ages until I came across this site.
[...] Maven dependency libraries not deploy in Eclipse IDE [...]