Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add "Maven Managed Dependencies" library in build path eclipse?

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 Build Path > Add Library > Maven Managed Dependency > Next in property dialog of the project, it asks me to Use "Maven Project Setting" to configure Maven dependency resolution.

My question is how to add maven dependencies in current build path?

like image 606
Amit Patel Avatar asked Feb 01 '11 07:02

Amit Patel


People also ask

Where do I put Maven dependencies in Eclipse?

Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.


2 Answers

from the command line type:

mvn eclipse:eclipse 

this will add all the dependencies you have in your pom.xml into eclipse...

however, if you haven't done any of this before you may need to do one other, one time only step.

Close eclipse, then run the following command from the shell:

mvn -Declipse.workspace=<eclipse workspace> eclipse:add-maven-repo 

sample:

mvn -Declipse.workspace=/home/ft/workspaces/wksp1/ eclipse:add-maven-repo 
like image 183
ftravers Avatar answered Oct 27 '22 01:10

ftravers


If you have m2e installed and the project already is a maven project but the maven dependencies are still missing, the easiest way that worked for me was

  • right click the project,
  • Maven,
  • Update Project...

Eclipse screenshot

like image 45
schnatterer Avatar answered Oct 26 '22 23:10

schnatterer