Force maven to download dependencies in Eclipse
If you have accidentally deleted the maven repository jars you installed by running maven install in Eclipse then you are reading the right tutorial. After facing this issue a couple of times and fixing it, I have written about the following solutions which can be used to retrieve the delete maven dependencies from Eclipse IDE. After adding a maven project in Eclipse, the Jar files look as shown below:
Solution 1 :
A very easy solution is to update the project using the option present in Maven menu as shown in following screenshot:
Note that running maven clean and maven install tasks will not work in this case as the deletion of dependency jar files is not detected in that case. After running the Update project task, you should get back the jar file and classpath issues should get resolved. If you are using any Eclipse version different from Juno, the above mentioned option could be present in some other setting.
Solution 2 :
If the above solution doesn’t resolve the issue, then simply delete the project from Eclipse workspace. Do not delete it from hard disk. In Eclipse now go to File -> New -> Import and choose “Existing Maven Projects”
Next browse the pom.xml file of your maven project and finish the wizard. You should get back the maven project in Eclipse. Now run maven install and then perform a project clean.
These steps should definitely resolve any dependency issues in Eclipse for your Maven project.