Repository Management with Nexus
A Repository Target is a set of regular expressions to match on the path of artifacts in a repository (in the same way as the routing rules work). Nexus is preconfigured with a number of repository targets and allows you to create additional ones. Access the management interface visible in Figure 6.31, “Managing Repository Targets” via the Repository Targets menu item in the left-hand Views/Repositories sub menu.
Repository targets allow you to define, for example, a target called
Apache Maven with a pattern of
^/org/apache/maven/.*. This would
match all artifacts with a groupId of org.apache.maven and any
artifacts within nested groupIds like org.apache.maven.plugins.
A pattern that would capture more artifacts like all artifacts with
any part of the path containing maven could be
The regular expressions can also be used to exclude artifacts as
visible with the pattern
Figure 6.32, “Excluding Source Artifacts from a Repository Targets” where artifacts with the qualifier
-sources are excluded. The syntax used for the expressions is the
that is similar but not identical to the Perl syntax.
By combining multiple patterns in a repository target, you can establish a fine-grained control of artifacts included and excluded.
Once you have created a repository target, you can it as part of your security setup. You can add a new privilege that relates to the target and controls the CRUD operations for artifacts matching that path. The privilege can even span multiple repositories. With this setup you can delegate all control of artifacts in org.apache.maven to a "Maven" team. In this way, you don’t need to create separate repositories for each logical division of your artifacts.
Repository targets are also be used for matching artifacts for implicit capture in the Staging Suite as documented in Chapter 11, Improved Releases with Nexus Staging.