Eclipse : Maven search dependencies doesn't work - eclipse

I created a new simple Maven project in a new Workspace.
When I open the pom.xml's Dependencies view in Eclipse editor, and I choose Add.. dependency, there's no search results no matter what search criteria I input in the search fields:
It instantly give me, for example, Results for 'spring' (0).
In my other workspace, with my existing projects I don't have this problem.
Is there a way to fix that ?

Eclipse artifact searching depends on repository's index file. It seems you did not download the index file.
Go to Window -> Prefrences -> Maven and check "Download repository index updates on start". Restart Eclipse and then look at the progress view. An index file should be downloading.
After downloading completely, artifact searching will be ready to use.
UPDATE
You also need to rebuild your Maven repository index in 'maven repository view'.
In this view , open 'Global Repositories', right-click 'central', check 'Full Index Enable',
and then, click 'Rebuild Index' in the same menu.
A 66M index file will be downloaded.

In your eclipse, go to Windows -> Preferences -> Maven
Tick the option "Download repository index updates on startup". You may want to restart the eclipse.
Also go to Windows -> Show view -> Other -> Maven -> Maven repositories
On Maven repositories panel, Expand Global repositories then Right click on Central repositories and check "Full index enabled" option and then click on "Rebuild index".

You can get this result if you are inside a corporate proxy and the new project isn't pointing to the correct settings.xml file with the proxy credentials.
You can also get this if you are using Maven proxy (Nexus, for example) and the index into the proxy is messed up somehow. I don't know a way to describe how to fix this. Fool around with it or call the one who set up the Maven proxy.
You can also get this if the new workspace hasn't yet downloaded the index either from Maven central or from the proxy. (This is the best one as you just have to wait a while and it will work itself out.)

For me for this issue worked to:
remove ~/.m2
enable "Full Index Enabled" in maven repository view on central repository
"Rebuild Index" on central maven repository
After eclipse restart everything worked well.

The maven add dependency is actually from the maven indexes. If the indexes is up to date, the result should be from there.
If you go to the maven repository, then select global repository, you should see a central ... tab, and select that, there should be a list of folders, and you should be able to see all the indexes from there. If not, then it means you didn't get the full index, then you can right click that and enable full index.
Another thing I annoyed me most is even I did everything, it still not showing anything when I type "spring". This is actually where I did wrong. If you just type some additional text "springframework", BOOM, the result is there.

I have the same problem. None of the options suggested above worked for me. However I find, that if I lets say manually add groupid/artifact/version for org.springframework.spring-core version 4.3.4.RELEASE and save the pom.xml, the dependencies download automatically and the search works for the jars already present in the repository.
However if I now search for org.springframework.spring-context , which isnt in the current dependencies, this search still doesn't work.

Use https://search.maven.org/ manually with the prefix fc: to search for class names. Both Netbeans and Eclipse seem to be too stupid to use that search interface and the gigabytes of downloaded repository indexes seem to not contain any class information. Total waste of disk space. Those IDE projects are so badly maintained lately, I wish they would move development to GitHub.

It is neccesary to provide Group Id and Artifact Id to download the jar file you need. If you want to search it just use * , * for these fields.

Related

Maven project in Eclipse gets no search results in "Select dependency", but added manually downloads resources

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.
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

Searching for dependencies returns nothing

I've just installed Eclipse Juno with m2e installed.
Then, I've created a new Maven project and decided I want log4j, so I opened the pom.xml, clicked on the Dependency tab, clicked on the Add... button and typed in log4j.
Zero results. The only thing that it finds is junit (that was automatically added to the project with the quickstart archetype, it seems). Note that I can add the log4j dependency manually and it will work just fine, but I find the search feature really convenient!
I'm a kind of a Maven beginner, though I got m2e working no problem in Indigo. So I'm thinking I might have forgot to set something?
All you have to do is update or rebuild your workspace maven repository index.
Open your "Maven Repositories" view. Open Global Repositories and right-click on central. Enable full index and rebuild.
Initially the process will take several minutes. After that your search will start working.
You can automate this process by turning Download repository index updates on startup on in your workspace preferences under Maven
in case rebuilding your workspace maven repository index didn't work, try reinstalling m2e. I updated mine via marketplace and it started working again. I'm not sure what was the issue but I suspect some URLs got changed recently.
Just go to Window -> Preferences -> Maven
and check the option Download repository index updates on startup and click Apply. That's all.

How to see repository path in Eclipse

Is it possible in Eclipse to see the full repository path associated with a project?
This is a bit trivial information so I would expect it would be available somewhere but I can't find it.
So for Subversion I can of course go to the command line and do svn info but I would expect that this information is also available in Eclipse. This is the most trivial but also the most essential information about a resource.
Right-click on the project or file and click properties. Then select the "Subversion" section from the left.
First of all, you have a Subversion plugin installed in Eclipse, right? Otherwise just add one, and everything comes up automatically.
Please have a look at the following preferences afterwards:
Team -> SVN -> Label decorations: There you can configure what is shown directly besides the project nodes in the project explorer. The available variables to configure what exactly is shown depend on whether you use the Subclipse or the Subversive plugin.
General -> Appearance -> Label decorations: There you globally enable/disable label decorations.

How can I update Maven Index manually?

I have this problem:
When I start Eclipse (Indigo Service Release 1 with Maven Integration for Eclipse) it's trying to download a file from Maven Repositories :
repo1.maven.org/maven2/.index/nexus-maven-repository-index.gz
It reaches about 10-20% (this takes loooong) and then apparently it gives up:
02.05.12 08:47:36 MESZ: Updating index central|http://repo1.maven.org/maven2
02.05.12 09:09:25 MESZ: Unable to update index for central|http://repo1.maven.org/maven2
Now I tried to download this gz-file manually because I thought, the download hits any timeout within Eclipse. Now I have another two problems:
The direct download of the 48,7 MB-gz-file canceled after 9,6 MB. I have no clue why.
If I'd be able to download the gz-file, I don't know how to "put it into" Eclipse/Maven or tell Maven to use the file on my PC and not the repository repo1.maven.org.
Any helpful ideas or answers?
Delete the cache from .m2/repository/.cache/m2e.
Open your eclipse
Menu Windows > Preferences > Maven > User Settings > Update Settings
Eclipse will download it again, should work now.
Try to change the timeout settings like described here. I do not know which setting is responsible for the repository index update, you have to try a bit...
-Dsun.net.client.defaultReadTimeout=60000
-Dorg.eclipse.ecf.provider.filetransfer.retrieve.readTimeout=60000
You should consider to disable the index update on startup (disable: Preferences -> Maven -> Download repository index updates on startup) and only update manually in the Maven Repositories View using the context menu on the central repository.
Well, that may be a little bit complicated but it worked for me:
First I used wget -c to download nexus-maven-repository-index.gz; took me about 10 retries and an hour; you may use any download manager you like
Second, installed Fiddler
Then updated <proxy> configuration in local maven settings.xml with Fiddler details
Enabled breakpoints in Fiddler
When Eclipse asked for nexus-maven-repository-index.gz used a Fiddler feature to substitute a response with a downloaded file
A more drastic way: delete the whole .metadata folder. Later import projects from their place or checkout them from the svn(if you use some). This is not much more complicated, but it helped. the problem is that we don't really know, what metadata are broken, so the natural next step is to delete all of them. I think, it is the deepest possible cleaning before reinstallation of Eclipse + plugins.

How can I make Eclipse file search not include svn directories?

When I do a file search on eclipse it includes the .svn directories by default. I tried excluding them from the build path but they still appear on file search results.
Spaceman is right. With Helios, choose Project -> Properties -> Resource -> Resource Filters and then add an exclude filter for type "Folder" with name .svn.
If you install the subclipse plugin then it automatically excludes the .svn directories (plus provides some other cool stuff in the IDE).
http://subclipse.tigris.org/
If it does not work, simply restart Eclipse (sometimes it's needed on a fresh checkout)
Following up on Mark Ingram's excellent answer, simply installing the plugin won't get you there -- You'll still need to Share your project in order for the automatic Search filtering to take hold. After you set up the SVN repository location from within the Subeclipse view you may Share your project by doing the following:
From within Package Explorer, right-click the project name
Select the Team context menu option and then Share Project....
Step trough the wizard to tie your project to its location in the svn repository
Once you complete that and the workspace rebuilds you are all set to enjoy filtered search.
Excluding the .svn folders by making them derived stops then appearing in the search results, see here.
You have to do it manually for each folder, if you have a lot of .svn folders then it's not ideal.
If you are gonig down the plugin route, I tend to prefer subversive over subclipse.
Ah - OK. I don't use SubVersion per se, but would this be of any use? It claims it can do what you want...
Eclipse import would also contain file of type .java.svn-base, so its better to give as in below image
[[1]: https://i.stack.imgur.com/szDxP.png][1]
You can off course also select ALL the file name patterns to include in the file search dialog
Click on the drop-down triangle in the top-right corner of the Navigator and choose "Filters..".
By default Eclipse only offers you ".class" and ".".
If you choose ".*" you'll hide .svn files. Obviously all other .something files will also be hidden.