How to Configure P2 to Cache Artifacts in a Remote Repository

JFrog Support
2023-01-22 11:08

To configure P2 to cache artifacts in Artifactory, you'll need to add a remote repository that will point to the URL where the artifacts with which you'd like to work are stored. You can create your remote repository via the Artifactory UI by:

  1. Navigating to Admin tab > Configuration > Repositories

  2. Under Remote repository, click New, and enter your repository key (i.e., the name of your repository in Artifactory), and the URL from which you'd like to resolve your artifacts (e.g., Eclipse’s Helios, Juno, or Tycho).

Another option is to create a virtual repository that will aggregate both your remote and local repositories. You can do this by:

  1. Navigating to Admin tab > Configuration > Repositories

  2. Select Virtual Repositories and create a new repository

  3. Under Remote P2 Repositories, enter the remote URL. Thereafter, Artifactory will recognize and display what action will be taken once you select the Save & Finish button.

After executing either scenario above, each time you resolve an artifact, Artifactory will first check the P2 cache and, if the artifact is present, Artifactory will provide it from the cache. Otherwise, Artifactory will download it from the URL you have provided and cache it for future use.

For further information please visit our wiki page about P2 Repositories.