Pub Repository Structure
The Pub repository structure is as follows.
Note the following:
- The index of the packages will be populated under the .pub , each package has his own json file that index the package versions.
- The binary of the library is populated under the package folder with a convention of the package name and the package version , for example:
All deployment of Pub packages into Artifactory must be under the
If packages are not deployed under this structure, they will not be included in any index file.
Setting up a Pub Repository
You can set up the following repository types:
Follow the steps according to each repository type below. A Pub package (
tar.gz) is deployed to a local PUB repository, and resolved using all repository types.
You can download packages from a local, remote, or virtual Pub repository.
Setting up a Local Repository
Local repositories enable you to deploy pub (
tar.gz) packages. Artifactory calculates the metadata for all packages and indexes them to allow users to download these packages through the Pub client.
To create a Pub local repository, navigate to the Administration module, go to Repositories | Repositories | Local | New Local Repository and select Pub as the Package Type.
Setting up a Remote Repository
Remote repositories enable you to proxy and cache Pub packages.
To specify that a Remote Repository supports Pub packages, you need to set its Package Type to Pub when it is created.
Setting up a Virtual Repository
A Virtual Repository defined in Artifactory aggregates packages from both local and remote repositories.
This allows you to access both locally hosted Pub packages and remote proxied Pub repositories from a single URL defined for the Virtual repository.
To define a virtual Pub repository, do the following:
- Create a Virtual Repository, and set the Package Type to Pub.
- Select the underlying local and remote Pub repositories to include in the Basic settings tab.
Pub SemVer 2.0 Package Support
Artifactory requires applying SemVer 2.0 rules for Pub repositories, which means you can now use pre-release numbers with dot notation or add metadata to the version, for example:
Artifactory serves the requests for downloading packages using SemVer 2.0 rules. For example, if the latest version for a certain package is in a SemVer 2.0 convention, Artifactory will return it to the client. NuGet packages with the SemVer 2.0 convention are served from local, remote, and virtual repositories and for both Pub API v2, and v3 feeds.
Configuring the Pub Client to Work with Artifactory
To use Artifactory with your Pub client, you will first need to set Artifactory as a Pub repository, and then to resolve and deploy the relevant
Dart/ Flutter package.
PrerequisiteYou will need to generate an authentication token. For more information, see Access Token Authorization Headers.
Step 1: Add Artifactory to your /
- Navigate to Application Module | Artifactory | Artifacts.
- Select the desired repository.
- Select Set Me Up.
In the Configure tab, add the repository to your client using the following command and run it.
Pub authentication to Artifactory is supported only through HTTPS-Only mode.
Step 2: Deploy Dart/ Flutter Packages
To deploy a Dart/ Flutter package into an Artifactory repository, use the following cURL with the relevant path parameters:
Deploying a Package Using the UI
Indexing Dart/Flutter Packages
For your files to be indexed properly, it is very important to ensure that all deployment of Dart/ Flutter packages into Artifactory occurs under the
<REPOSITORY>/<PACKAGE_NAME/ <FILE> <VERSION> structure. Packages deployed anywhere else will not be indexed.
To deploy a Dart/ Flutter package to Artifactory, do the following:
- Navigate to Artifactory | Artifacts | Deploy.
- Select your Pub repository as the Target Repository.
- In the Target Path, specify the relative path in the target repository.
Step 3: Resolve and Deploy Dart/ Flutter Packages
To resolve Dart packages:
- In the Application module, navigate to Artifactory | Artifacts.
- In the Artifact Tree Browser, select a Pub repository and click Set Me Up.
Viewing Individual Pub Package Information
Artifactory lets you view selected metadata of a Pub package directly from the UI.
In the Artifact Repository Browser, select your local Pub repository and scroll down to find and select the package you want to inspect.
The metadata is displayed in the Pub Info tab, or viewed in the Packages view.
Re-indexing a Pub Repository
You can trigger an asynchronous re-indexing of a local Pub repository either through the UI or using the REST API.
In the Artifact Tree Browser, select your Pub repository, right-click and select Recalculate Index from the list (requires Admin privileges).
To re-index a Pub repository through the REST API, see Calculate Pub Repository Metadata.
REST API Support
The Artifactory REST API enables the recalculation of the repository index, as described in Calculate Pub Repository Metadata