I have created a Maven
project and I want to add all Maven
dependencies in build path of the project in Eclipse
. When I go to Java Bui
If Maven->Update Project doesn't work for you? These are the steps I religiously follow. Remove the project from eclipse (do not delete it from workspace) Close Eclipse go to command line and run these commands.
mvn eclipse:clean
mvn eclipse:eclipse -Dwtpversion=2.0
Open Eclipse import existing Maven project. You will see the maven dependency in our project.
Hope this works.
Likely quite simple but best way is to edit manually the file .classpath at the root of your project folder with something like
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
when you want to have jar in your WEB-IN/lib folder (case for a web app)
I could figure out the problem. I was getting following warning on startup of eclipse.
The Maven Integration requires that Eclipse be running in a JDK, because a number of Maven core plugins are using jars from the JDk.
Please make sure the -vm option in eclipse.ini is pointing to a JDK and verify that
Installed JRE's are also using JDK installs
I changed eclipse.ini file and added following and restarted eclipse
-vm
C:/Program Files/java/jdk1.6.0_21/bin/javaw.exe
Now I can see "Maven Dependency" library included automatically in java build path.