Pub Repository Structure
The Pub repository structure is as follows.
|-.pub/.json |---- / - .tar.gz
Note the following:
- 包将被填充的索引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:
pedentic/pedantic-1.9.1.tar.gz.
Deployment Structure
All deployment of Pub packages into Artifactory must be under the
structure.
If packages are not deployed under this structure,they will not be included in any index file.
Setting up a Pub Repository
Youcan set up the following repository types:
Follow the steps according to each repository type below. APub 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 themto allow users to download these packages through the Pub client.
To create a Pub local repository, navigate to theAdministrationmodule, go toRepositories|Repositories|Local|New Local Repositoryand selectPubas thePackage 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 itsPackage TypetoPubwhen 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 aVirtual Repository, and set thePackage TypetoPub.
- Select the underlying local and remote Pub repositories to include in theBasicsettingstab.
Pub SemVer 2.0 Package Support
Artifactory requires applyingSemVer 2.0 rulesfor Pub repositories, which means you can now use pre-release numbers with dot notation or add metadata to the version, for example:MyApp.3.0.0-build.60
,MyApp.1.0+git.52406
.
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 thento resolve and deploy the relevantDart/ Flutter
package.
Prerequisite
You will need to generate an authentication token. For more information, seeAccess Token Authorization Headers.Step 1: Add Artifactory to your/etc/pub/repositories
File
- Navigate toApplication Module | Artifactory | Artifacts.
- Select the desired repository.
- SelectSet Me Up.
In theConfiguretab, add the repository to your client using the following command and run it.
HTTPS-Mode Only
Pub authentication to Artifactory is supported only through HTTPS-Only mode.
步骤2:部署飞镖/颤振ckages
To deploy a Dart/ Flutter package into an Artifactory repository, use the following cURL with the relevant path parameters:
cURL
|
Deploying a Package Using the UI
Indexing Dart/Flutter Packages
For your files to be indexed properly, it is very important to ensure thatalldeployment of Dart/ Flutter packages into Artifactory occurs under the
To deploy a Dart/ Flutter package to Artifactory, do the following:
- Navigate toArtifactory | Artifacts | Deploy.
- Select your Pub repository as theTarget Repository.
- In theTarget 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 toArtifactory | Artifacts.
- In the Artifact Tree Browser, select a Pub repository and clickSet Me Up.
Viewing Individual Pub Package Information
Artifactory lets you view selected metadata of a Pub package directly from the UI.
In theArtifact 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 thePub Infotab, or viewed in thePackagesview.
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 theArtifact Tree Browser, select your Pub repository, right-click and selectRecalculate Indexfrom the list (requires Admin privileges).
To re-index a Pub repository through the REST API, seeCalculate Pub Repository Metadata.
REST API Support
The Artifactory REST API enablesthe recalculation of the repository index, as described inCalculate Pub Repository Metadata