Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the indexing of Maven artifact repositories work

I would like to understand how the indexing for the artifact repositories like Nexus and Artifactory works. What benefit does it provide? I mean -- how does it help and what is the logic that's used when resolving artifacts?

My understanding is that the Lucene indexes contain information concerning which artifacts are presents in a given proxied repository or group and that once these indexes have been downloaded, you can easily check if a remote repository contains the artifact you're looking for and you can try to resolve it from the repositories which have it. Is this the only use? Is the index also queried for local resolutions (because each repository does have an index)...? How does this actually work?

like image 299
carlspring Avatar asked Jun 09 '13 16:06

carlspring


2 Answers

Artifactory doesn't use indexes for searching. We believe that indexes are the thing of the past, when machines were slow and couldn't handle large searches on the server side. Here is only partial list of why search indexes are bad:

  • Client need to download huge files before searching
  • The indexes are updated too rare to reflect frequent changes
  • System with search indexes requires special client to perform the search against
  • The client it toughly coupled with the index format.

Nowdays, when servers like Artifactory can provide real-time searching, exposed via UI for humans an API for tools like IDEs, the indexes are obsolete and supported in Artifactory only for compatibility with tools like m2eclipse.

like image 89
JBaruch Avatar answered Sep 19 '22 12:09

JBaruch


Repository indexing is all about searching. The Maven Eclipse plugin documentation describes the functionality:

  • http://books.sonatype.com/m2eclipse-book/reference/repository-sect-repo-view.html#d5e1169

Maintaining a server-side index makes Maven client operation more efficient. Server-side repository managers can use indexes to enable search interfaces and REST APIs for retrieving artifacts (Sonatype Nexus doesn't need a database).

like image 37
Mark O'Connor Avatar answered Sep 18 '22 12:09

Mark O'Connor