Overview
Artifactory allows you to define a virtual repository which is a collection of local, remote and other virtual repositories under a single logical URL.
A virtual repository hides the underlying repositories and lets users work with a single, well-known URL, while allowing you to change the participating repositories and their rules without requiring any client-side changes.
The main features supported by a virtual repository are:
- Nesting
- Include Exclude patterns filter
- Automatic removal of repository references
- WebStart automatic signing and JNLP file conversion
Setting Up a Virtual Repository
From the Admin tab go to Configuration -> Repositories -> Virtual Repositories and create a new virtual repository.
Add the repositories you want to be part of the virtual repositories to the virtual repository list of selected repositories.
The actual list of effectively resolved repositories (after expanding nested virtual repositories) is displayed and automatically updated.

| Field Name | Description |
|---|
| Public Description | Free-text field description of the repository. This description also appears when selecting the repository in the tree browser. |
| Internal Notes | Free-text field for optional notes about this repository. |
| Includes Pattern | Comma-separated list of artifact patterns to include when evaluating artifact requests, in the form of x/y/**/z/*. When used, only requests matching one the include patterns are served. By default, all artifacts are included (**/*). |
| Excludes Pattern | Comma-separated list of artifact patterns to exclude when evaluating artifact requests, in the form of x/y/**/z/*. By default, no artifacts are excluded. |
| Repositories | A set of local and remote repository references to include in a virtual repository. |
| Resolved Repositories | The resolved list of repositories. Repositories beginning with an exclamation mark ('!') indicate that not all tokens can be mapped between the layout of this virtual repository and the marked repository. Path translations may not work as expected. |
Nesting Virtual Repositories
The ability to nest virtual repositories is unique to Artifactory. It allows for greater reuse of virtual repositories between themselves.
Include Exclude Patterns in Virtual Repositories
The coupling of Include/Exclude patterns of Artifactory Configuring Repositories to virtual repositories nesting provides a powerful feature.
You can define in a single virtual repository "remote-repos" the company groupId exclusion, and it ensures that no requests for internal artifacts are sent externally.
Another example for this feature, is defining virtual repository for a project and filter undesirable groupId, sources or versions, that are not visible to developers.
Serving Requests from Other Artifactory Instances
By marking the 'Artifactory Requests Can Retrieve Remote Artifacts' checkbox, you can instruct Artifactory whether the virtual repository should include remote repositories in artifacts resolution when answering requests coming from other Artifactory instances. This is useful when deploying Artifactory in a mesh (grid) architecture, where you do not want all remote Artifactories to act as remote proxies for other Artifactory instances.

| Field Name | Description |
|---|
| Repository Layout | Select the layout that the repository should use for storing and identifying modules. |
| Artifactory Requests Can Retrieve Remote Artifacts | Mark this checkbox to determine whether artifact requests arriving from other Artifactories can be fulfilled by accessing this virtual repository's remote repositories or by only accessing its caches (the default). |
| Cleanup Repository References in POMs | (1) Discard Active References - Removes repository elements that are declared directly under project or under a profile in the same POM. By default, this is active. (2) Discard Any References - Removes all repository elements regardless of whether they are included in an active profile or not. (3) Nothing - Does not remove any repository elements declared in the POM. |
| Key Pair | A named key-pair to use for automatically signing artifacts. |
| Zap Caches | Clears all caches stored at the virtual repository level (transformed POMs, JNLP files, merged indexes, etc.) |
Ensuring Artifactory is Your Sole Artifacts Provider
One very bad practice often used on public POMs, is to add a direct reference to an external repository in a POM. When either of the code examples below are present, Maven dynamically adds an external repository URL to the build. This shortcuts Artifactory.
or
Until now, the solution was using mirrorOf as described here.
Artifactory provides at the virtual repository level, an automatic cleanup of POM file. Three levels of cleanup policy are configurable:
- Discard Active References - Removes repository elements that are declared directly under project or under a profile in the same pom that is activeByDefault.
- Discard Any References - Removes all repository elements regardless of whether they are included in an active profile or not.
- Nothing - Does not remove any repository elements declared in the POM.
Pre-canned Repositories
Artifactory comes with a set of per-defined virtual repositories, which reflect binary management best practices.
| |
|---|
remote-repos | Aggregation of all remote repositories |
lib-releases | libs-releases-local, ext-releases and remote-repos |
plugins-releases | plugins-releases-local, ext-releases and remote-repos |
libs-snapshots | libs-snapshots-local, ext-snapshots-local, remote-repos |
plugins-snapshots | plugins-snapshots-local, ext-snapshots-local, remote-repos |
repo | Aggregation of all repositories |