Eclipse or Spring Tool Suite - Maven - Cannot Add Dependencies ( Solution )



Hello everyone,

Today, I am going to post the solution of a frustrating problem that can occur while trying to add dependencies to your Maven project in Eclipse or Spring Tool Suite (STS).


When you open the pom.xml's Dependencies tab in Eclipse editor, and choose Add.. dependency, if there's no search results no matter what search criteria you input in the search fields, you are not alone...


Add New Dependency


The solution to this problem is to download the index files from a repository.

But first of all, go to Window -> Preferences ->Maven - > User Settings and paste this URL:

http://repo.maven.apache.org/maven2

to the Global Settings field as shown in the figure below.
Global Settings
Then go to Window -> Preferences ->Maven 

and select the ones shown in the figure below;

Maven Settings

After all these, go to Window > Show View > Other > type Maven in filter and select Maven Repositories. In Maven Repositories tab Expand Global Repositories, Right-click on central and select Full Index Enabled. Then a download process will begin and this will approximately take 10-30 mins (I know it is too much but you have to be patient) depending on your internet connection.
Eclipse or Spring Tool Suite - Maven
Updating Indexes

When the download completes, I suggest you to restart Eclipse or STS and then you will be able to add dependencies to your Maven project! 

Here is the screenshot that proves this method. Hope this helps! 

Solution


Please leave a comment if you have any comments or questions. Thanks!
Author:

Software Developer, Codemio Admin

Disqus Comments Loading..