Maven dependencies not being added to WEB-INF/lib

21,903

Solution 1

Looks like your "Deployment Assembly" is missing the Maven Dependencies being added to the packaging structure of your project. The way this should look is:

enter image description here

The way to add that in is:
- click on Add
- select Java Build Path Entries
- select Maven Dependencies
- Finish

That should add your Maven Dependencies into WEB-INF/lib. In case your project structure is not standard, you can also edit that path by double-clicking inside your Deploy Path column - in this case, on WEB-INF/lib.

Hope that helps.

Solution 2

Open your project folder and find the .classpath file,edit it and add follow code

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>
</classpathentry>

Solution 3

I have just had the same problem after improting a new maven web project in my newly created workspace. I checked everything mentioned above: by @Eugen, @lucky, @Cary - all of this was already presented in my project.

I solved my problem by right-clikcing on my it and selecting Maven-->Update Project

Share:
21,903
Myna
Author by

Myna

Updated on July 09, 2022

Comments

  • Myna
    Myna almost 2 years

    Fairly new to Spring, Maven, Tomcat and all, I am trying to set up a Spring Web Project in Eclipse, using Maven then deploy the project to Tomcat.

    I am following this tutorial, suggested by a SOF member : http://www.beingjavaguys.com/2013/08/spring-maven-web-application-in-eclipse.html

    I am having troubles to have Maven add the dependencies specified in pom.xml, to Tomcat's WEB-INF/lib. I have scrupulously followed the steps, but in the part "Run Spring Maven project in eclipse", I do not get the same deployment assembly screenshot. This is what I get :

    Web deployment assembly in Eclipse, after running <code>mvn eclipse:eclipse -Dwtpversion=2.0</code>

    I checked in Eclipse that WTP is here, and it is (Help -> Install new Software -> Link "what is installed?") However the version I see for m2e-wtp is 1.0.**. SO I tried to run the mvn eclipse:eclipse -Dwtpversion=1.0 command (using version 1.0 instead of 2.0) but still the same problem...

    Anybody has had the same problem ? I have seen similar questions, tried what was suggested but nothing worked for me unfortunately. For example I went in Web Deployment Assembly and clicked Add -> Java Build Path Entries but I don't see a Maven Dependencies checkbox : what I see is a list of entries of the form M2_REPO/.../...

    Happy Holidays everyone, and thanks in advance for any help on this Myna