Home > Software engineering >  Maven project in Eclipse gets no search results in "Select dependency", but added manually
Maven project in Eclipse gets no search results in "Select dependency", but added manually

Time:12-16

No results when doing this

Both in Eclipse 4.20 and 4.25** with m2e 2.0.4 — Maven is embedded 3.8.6 — when in the pom.xml of a maven project and having selected "Add" of the "Dependencies" tab, I search for a known maven resource and there are no results found, for example if I'm looking for 'spring', and I enter in the field "Enter groupId, artifactId, or sha1 prefix or pattern (*):", for example 'spring', 'spring*' or '*spring*'.

I've never had to fill in Group Id or Artifact Id before, but the dialog is indeed stating neither of these can be empty. If I fill them in with say 'org.springframework' and 'spring-core' for example, this makes no difference other than it then says "Searching 'spring'", if that's my search term. Still nothing is found.

Expected

That just typing say 'spring', for example, in the search field would give me some results. This has worked like this for me for more than a decade, so that's why I'm expecting this to work.

Tried this so far

  • I've tried to re-index, but this is only possible in Eclipse 4.20 and not in 4.25… <Edit> actually if you click the circling arrow symbol Eclipse offers to "Reload settings.xml" which is said to "rebuild the indexes for the repositories". However, this makes no difference in either version.</Edit>
  • "Download repository index updates on startup" is active. Also tried with it off.
  • Do not automatically update dependencies from remote repositories" is disabled.
  • Also tried making a fresh workspace in 4.25.
  • Maven > Update project with Force Update config.
  • disabled any network filters. Though this does not seem to be involved, see below.
  • Restarted the system.
  • Checked the fresh workspace for settings that could affect maven and found none. There is only a version.ini file inside .metadata.
  • Read several previous questions like this one from the last 10 years. All are familiar, but suggestions from these older cases make no difference in this case.

Artefacts are downloaded

If I add the artefacts manually as text in the pom.xml, there are no issues getting them to download to my repository folder, which is why I don't think there is a network problem. When I do this there are no issues whatsoever to develop.

Clues

I don't think these should make a difference:

  • In "Maven" > "User Settings" Global Settings is empty
  • User Settings points to a non-existing settings.xml

but maybe these could point to a solution? Again, that manually adding works, may suggest these are both non-issues. I do wonder if the m2e config/install may be involved. I'm not sure how though.

** Note that Eclipse 4.25 is aarch64 fresh installed on this Apple Silicon Mac with macOS 12.6.1. Eclipse 4.20 is also aarch64, but has been updated since 2021.

CodePudding user response:

Searching for dependencies is currently broken in the Dependencies tab, but you can search and add dependencies in the pom.xml tab instead, which works even without downloading an index.

See Eclipse m2e issue #930: Artifact search is not working in Add dialog on Dependencies tab

  • Related