Eclipse : Maven search dependencies doesn't work (and there is no "Full Index Enable" option) - eclipse

The dependencies search box never offers any dependencies, and when I try to follow the instructions found online, they always say the same 2 things, which among other, don't work
I tried these (among many other things, other computers, other OS, other networks etc, other Eclipse versions, etc)
"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."- This isn't changing anything
"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."- when i right click on central, there is no Full Index Enable option, just "copy URL" and "collapse"

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

Eclipse and git - every time I switch branches my JRE system library gets reset

On different dev machines (some Win, some Mac) my JREs are in different places. On my Mac, every time I fetch or switch branches I seem to have to reset my JRE paths to System default from an explicit JDK version. Where is this information stored and how do I keep this out of git, or deal with it in a better fashion?
That information, when specified on a project level, is stored in the .classpath file. You should either tell git to ignore that file (it's quite common to ignore "dot resource" files) or you should change the classpath file to use the default JVM.
Do the latter by selecting the project and selecting "Build Path -> Configure Build Path" in the context menu. Go to the Libraries tab, select the JVM listed and click "remove". Next click on "Add Library..." and choose "JRE System Library". After clicking "Next" choose the default JVM and click "OK".
One more related comment. If you were to use maven, a lot of these build configuration issues would go away. Of course, there's a bit of a learning curve cost to that, too.

Eclipse : Maven search dependencies doesn't work

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.

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.

Empty goals list in m2Eclipse

When I try to add a goal I don't get any goals. Is there any solution or I should manually add them.But in an example I saw it automatically lists all the available goals.
The workaround described in m2eclipse JIRA worked for me: In Eclipse, open the view "Maven Repositories" and expand "Global Repositories". Right-click on your mirror of central (or "central" if no mirror defined) and select "Enable Full Index". Right-click again on the repository and select "Rebuild Index". Wait until "Updating indexes" finishes and vanishes from the Eclipse progress indicator in the lower right corner.