Subby
Subby

Reputation: 2036

Cannot search for artifact in Eclipse Kepler using m2e plugin

I tried the new Eclipse Kepler that already comes with a maven plugin.

But when I want to add a dependency (open the pom.xml, go to dependencies tab and click add) I can input some string like "jetty" in the search box but nothing happens. In older versions I got a list of all dependencies containing "jetty".

I don't know if this is important but I directly get an info when opening the "add dependency screen": "Artifact Id cannot be empty".

I do not use a proxy or have any network issues.

I also missed an information something like: "indexing maven repo..."

Any idea?

Thanks!

Upvotes: 24

Views: 23843

Answers (10)

Trant Batey
Trant Batey

Reputation: 37

I recently had this same issue. I followed all of the suggestion above and the problem persisted. Then I opened the "Local Repository", right click on the "Local Repository" sub link>rebuild index. That fixed the issue. So, if "Rebuild Index" on the "Global Repository/central" doesn't work, try "Rebuild Index" on the "Local Repository/Local Repository"

Upvotes: 0

randombee
randombee

Reputation: 719

In case it can help someone... I had the same problem, tried to fix it doing all the steps everyone is mentioning in the other answers and I couldn't fix it like that. In the end, the solution was to delete the content of the settings.xml file in my .m2 folder. For some reason, it was using a different global repository, not the default maven one. After that, I got the expected behaviour.

Upvotes: 0

Renat Gatin
Renat Gatin

Reputation: 6396

I had same problem! It is because you do not have STS (Spring Tool Suite) installed. Go to Marketplace install it and it is gonna work!

Upvotes: 1

enri
enri

Reputation: 631

I had the same problem. I have done what Yogi and erasmus77 said but after all the message "Artifact Id cannot be empty" remained. So I ignored the message and I wrote the dependency in the search bar and then results appeared!

Thank you for this question!

Upvotes: 0

user3577339
user3577339

Reputation: 1

I did "In Maven Repositories tab Expand Global Repositories, Right-click on central and Update Index", it did not work, then click left expand triangle, it ran, and wait for while. Now it works

Upvotes: 0

Yogesh
Yogesh

Reputation: 4784

I had similar situation and by googling for a while i found out that this is most likely because your central Repository index might never have been updated. For this what you can do is

  1. Go to Window > Show View > Other > type Maven in filter and select Maven Repositories.
  2. In Maven Repositories tab Expand Global Repositories, Right-click on central and Update Index.

also you can set up index to update on eclipse startup Windows > Preferences > Maven and check "Download repository index updates on startup".

Hope this helps some one else.

Upvotes: 60

user2645075
user2645075

Reputation: 11

Another gotcha is that it won't start searching until you've entered several characters

  1. nz.ac
  2. com.mi
  3. junit

Upvotes: 1

erasmus77
erasmus77

Reputation: 327

I solved the same problem by going to Window > Show View > Other > Maven > Maven Repositories

Expand global repositories right click central > Rebuild index (wait for it) When it finishes Expand local repositories and do the same for the local repository (rebuild index) If you encounter some error simply try again. It worked for the second time and now i can search maven repo.

Upvotes: 3

Dennie
Dennie

Reputation: 753

Windows > Preferences > Maven and check "Download repository index updates on startup".

Restart and you're all fixed.

Upvotes: 10

Subby
Subby

Reputation: 2036

Very strange but now it worked using the following way:

  1. Add some dependency directly in the pom.xml
  2. Save the pom.xml to trigger the change. Now the library added directly appears in the project.
  3. Now I also got messages in the status bar like "indexing... " and "searching repository"
  4. I am now able to add an dependency using the method from the question. It now retrieves a list of artifacts of which I can choose.

Maybe a bug as also the add dialog should trigger the first repository search/indexing.

The information: "Artifact Id cannot be empty" still appears and had nothing to do with the problem.

Upvotes: 4

Related Questions