Tag Archives: search

You Don’t Need A Browser to Use Maven Central


June 9, 2011 By Joel Orlina

Since its release in January, the Maven Central website (http://search.maven.org) has provided Apache Maven users with:

  • Search functionality that allows one to quickly track down artifacts and their dependency details when trying to resolve build problems.
  • Browse functionality that aids in discovery of new artifacts to use in projects.

In the intervening months, Sonatype has focused its efforts on improving the usability of the Maven Central user interface in the hopes of making it the first place users look when trying to find an artifact.  Recently, users who have reaped the benefits of using the Maven Central website have asked about interacting programmatically with the search functionality.

If you pay attention to your web browser’s address bar when conducting searches on Maven Central, you can already see that a REST-style API exists.  For example, searching for “guice” from the main search box results in the following URL being generated (the following URL’s are NOT URL-encoded for the sake of readability):

Translating the search request into English, that URL requests a basic search for any artifact (irrespective of version) containing the word “guice” in either the groupId or artifactId, returning only the first page of results.  Each row of the results shows the latest version of the artifact and the date the artifact was last updated as well as any classifiers associated with the artifact.

You can build up the complete library of search requests simply by paying attention to your web browser’s address field as you use the Maven Central website.  For the sake of convenience, we’ve collected all the URLs that make up Maven Central’s search API in a document available here.

Sadly, these URL’s are still only useful when requesting them via web browser.  They are links that can be bookmarked or e-mailed, but they do NOT work when using a non-browser agent like wget or curl.  The Maven Central user interface is essentially a browser-based application that uses Javascript to make asynchronous requests to yet another set of URL’s.  Once you make a request that looks like the URL above, the browser fires off the actual request to another Maven Central URL responsible for conducting the search and returning results that are formatted by the browser.

The sample request above, when converted to an actual Maven Central search request, looks like this:

The actual text of your query goes in the appropriately named “q” parameter, the “rows” parameter restricts the results to a smaller number than the full result set, and the “wt” parameter can be either “xml” or “json,” depending on how your application prefers to handle results.

Some useful examples appear below.  Again, please refer to the API Guide for a complete listing:

In an upcoming post, I’ll describe the architecture behind Maven Central that makes all this functionality possible.

Searching Central Just Got Easier with Nexus


October 16, 2009 By Tim O'Brien

We’ve made a small, but important change to the front page of http://repository.sonatype.org.    (You might recognize the design.)

Searching the Central Maven Repository Just Got Easier from Sonatype on Vimeo.

To search for an library or an artifact:

  1. Go to http://repository.sonatype.org
  2. Type in an artifact or group identifier, a class name, or a checksum.
  3. Press Enter.

Once you have located the artifact you were looking for, click on the artifact and copy the dependency XML from Nexus to your POM.   It couldn’t get any easier or intuitive.   Make sure to bookmark http://repository.sonatype.org.

Use repository.sonatype.org to Search Central Maven Repository


November 19, 2008 By Tim O'Brien

If you are looking for the easiest way to search for artifacts in the Central Maven Repository, go to http://repository.sonatype.org. Sonatype maintains a publi instance of Nexus that can be used to search for artifacts by GAV (groupId, artifactId, version) coordinates, Class Name, or Checksum. Here’s a brief demonstration of the search capabilities on http://repository.sonatype.org.

[vimeo]http://www.vimeo.com/2283525[/vimeo] NOTE: Maximize Video to Full Screen Mode to see Details Continue reading

Searching the Maven Repository


November 11, 2008 By Tim O'Brien

A common question from Apache Maven users is “How do I search the central repository?” or “How do I find out what groupId or artifactId I should use for a specific dependency?”  Use Sonatype’s Nexus installation at http://repository.sonatype.org to search multiple repositories at once.    Sonatype has an instance of Nexus serving as a mirror of a number of repositories including Central.   If you are looking for the right XML to put in your project’s POM for a dependency like Log4J or ActiveMQ, just load repository.sonatype.org in your browser..

Continue reading