Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependencies not being added to WEB-INF/lib

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

like image 722
Myna Avatar asked Dec 21 '13 11:12

Myna


Video Answer


2 Answers

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.

like image 112
Eugen Avatar answered Nov 09 '22 05:11

Eugen


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>
like image 28
Cary Avatar answered Nov 09 '22 06:11

Cary