• No results found

Searching for Components

In document Repository Management with Nexus (Page 87-93)

Using the Nexus User Interface

5.10 Searching for Components

5.10.1 Search Overview

In the left-hand navigation area, there is an Artifact Search text field next to a magnifying glass. To search for a component by groupId or artifactId, type in some text and click the magnifying glass. Typing in the search term junit and clicking the magnifying glass should yield a search result similar to Figure5.19.

Figure 5.19: Results of an Artifact Search for "junit"

The groupId in the Group column and the artifactId in the Artifact column identify each row in the search results table. Each row represents an aggregration of all components in this Group and Artifact coordinate.

The Version column displays a link to Show All Versions, which triggers a search for the specific group and artifact.

The Most Popular Version column displays the version that has the most downloads by all users accessing the Central Repository. This data can help with the selection of an appropriate version to use for a particular component.

The Download column displays direct links to all the components available for the latest version. A typical list of downloadable components would include the Java archive jar, the Maven pom.xml file pom, a Javadoc archive javadoc.jar and a Sourcecode archive sources.jar, but other download options are also added if more components are available. Click on the link to download an component.

Each of the columns in the search results table can be used to sort the table in Ascending or Descending order. In addition, you can choose to add and remove colums with the sort and column drop-down options visible in Figure5.20.

Figure 5.20: Sort and Column Options in the Search Results Table

The repository browser interface below the search results table will displays the component selected in the list in the repository structure with the same information panels available documented in Section5.2.

An component could be present in more than one repository. If this is the case, click on the value next to Viewing Repositoryto switch between multiple matching repositories.

Warning

Let me guess? You installed Nexus, ran to the search box, typed in the name of a group or a component, pressed search, and saw absolutely nothing. No results. Nexus isn’t going to retrieve the remote repository indexes by default. You need to activate downloading of remote indexes for the three proxy repositories that Nexus are shipped with Nexus. Without these indexes, Nexus has nothing to search. Find instructions for activating index downloads in Sec-tion6.2.

5.10.2 Advanced Search

Clicking on the (Show All Versions) link in the Version column visible in Figure5.19 will initiate an Advanced Searchby the groupId and artifactId of the row and result in a view similar to Figure5.21.

Figure 5.21: Advanced Search Results for a GAV Search Activated by the Show All Versions Link

The header for the Advanced Search contains a selector for the type of search and one or more text input fields to define a search and a button to run a new search with the specified parameters.

The search results table contains one row per Group (groupId), Artifact (artifactId), and Version(version).

In addition, the Age column displays the age of the components being available on the Central Repository.

Since most components are published to the Central Repository when released, this age gives you a good indication of the actual time since the release of the component.

The Popularity column shows a relative popularity as compared to the other results in the search table.

This can give you a good idea on the adoption rate of a new release. For example if a newer version has a high age value, but a low popularity compared to an older version, you might want to check the upstream project and see if there is any issues stopping other users from upgrading that might affect you as well.

Another reason could be that the new version does not provide signifcant improvements to warrant an upgrade for most users.

The Security Issues column shows the number of known security issues for the specific component. The License Threatcolumn shows a colored square with blue indicating no license threat and yellow, orange and red indicating increased license threats. More information about both indicators can be seen in the Component Infopanel below the list of components for the specific component.

The Download column provides download links for all the available components.

The following advanced searches are available:

Keyword Search

Identical to the Artifact Search in the left-hand navigation, this search will look for the specified strings in the groupId and artifactId.

Classname Search

Rather than looking at the coordinates of an component in the repository, the Classname Search will look at the contents of the components and look for Java classes with the specified name. For example, try a search for a classname of Pair to see how many library authors saw a need to implement such a class, saving you from potentially implementing yet another version.

GAV Search

The GAV search allows a search using the Maven coordinates of a component. These are Group (groupId), Artifact (artifactId), Version (version), Packaging (packaging), and Classifier (classifier).

At a minimum you need to specify a group, component, or version in your search. An example search would be with a component guice and a classifier no_aop or a group of org.glassf ish.main.adminguiand a packaging war. The default packaging is jar, with other values as used in the Maven packaging like ear, war, maven-plugin, pom, ejb and many others being possible choices.

Checksum Search

Sometimes it is necessary to determine the version of a jar component in order to migrate to a qualified version. When attempting this and neither the filename nor the contents of the manfiest file in the jar contain any useful information about the exact version of the jar, you can use Checksum Searchto identify the component. Create a sha1 checksum, e.g., with the sha1sum command available on Linux or fciv on Windows, and use the created string in a checksum search. This will return one result, which will provide you with the GAV coordinates to replace the jar file with a dependency declaration.

Metadata Search

Search for components with specific metadata properties is documented in Section5.10.3.

Tip

The checksum search can be a huge timesaver when migrating a legacy build system, where the used libraries are checked into the version control system as binary components with no version information available.

5.10.3 Searching Artifact Metadata

To search for components with specific metadata, click on the Advanced Search link directly below the search field in the Artifact Search submenu of the Nexus menu. This opens the Search panel and allows you to select Metadata Search in the search type drop-down as shown in Figure5.22.

Figure 5.22: Searching Artifact Metadata

Once you select the metadata search you will see two search fields and an operator drop-down. The two search fields are the key and value of the metadata for which you are searching. The operator drop-down can be set to Equals, Matches, Key Defined, or Not Equal. Equals and Not Equals compare the value for a specific key. Matches allows the usage of * to allow any characters. E.g., looking for tr* would match true but also match tree. The Key Defined operator will ignore any value provided and return all components with the supplied key.

Figure 5.23: Metadata Search Results for Custom Metadata

Once you locate a matching component in the results list, click on the component and then select the Artifact Metadata to examine an components metadata as shown in Figure5.24.

Figure 5.24: Metadata Search Results for Custom Metadata

In document Repository Management with Nexus (Page 87-93)