Once the Conan client is installed, you can access Conan repositories in Artifactory through its command line interface. You can only install packages from or export packages to your Artifactory local Conan repository using the Conan client.
Local vs. Remote
Don't let Conan terminology confuse you. For the purposes of this integration, the Conan "Remote" is actually the Artifactory local repository you have created for Conan packages.
Once you have created your Conan repository, select it in the Tree Browser view in the Application module, Artifactory | Artifacts tab, and click Set Me Up to see the code snippets you will need in order to use your repository as a source to install packages and as a target for export.
In the sections below, <REMOTE> is used to denote the logical name you set with which the Conan client can identify the Conan local repository in Artifactory.
Add Your Repository
To use your local repository with Conan, you first need to add it as a Conan "Remote" to the client as follows:
conan remote add <REMOTE> http://<ARTIFACTORY_URL>/api/conan/<REPO_KEY>
Where:
<REPO_KEY> is the repository key.
Conan repositories must be prefixed with api/conan in the path
When accessing a Conan repository through Artifactory, the repository URL must be prefixed with api/conan in the path. This applies to all Conan commands including conan install
.
For example, if you are using Artifactory standalone or as a local service, you would access your Conan repositories using the following URL:
http://localhost:8081/artifactory/api/conan/<repository key>
Or, if you are using Artifactory Cloud, the URL would be:
https://<server name>.jfrog.io/artifactory/api/conan/<repository key>
Authenticate the Conan Client
To authenticate the Conan client to Artifactory you need to log in using:
conan user -p <PASSWORD> -r <REMOTE> <USERNAME>
Accessing Artifactory anonymously
If Artifactory is configured for anonymous access, you may skip authenticating the Conan client.
Allow Anonymous Access
Artifactory supports Conan repositories with Allow Anonymous Access enabled.
When Allow Anonymous Access is enabled, Artifactory will not query the Conan client for authentication parameters by default, so you need to indicate to Artifactory to request authentication parameters in a different way.
You can override the default behavior by setting the Force Authentication checkbox in the New or Edit Repository dialog.
When set, Artifactory will first request authentication parameters from the Conan client before trying to access this repository.
Install Dependencies
To install dependencies from Artifactory as defined in your conanfile.txt
file use:
conan install . -r <REMOTE>
Upload Packages
To upload packages to your Artifactory local Conan repository use:
conan upload <RECIPE> -r <REMOTE> --all
Where <RECIPE> specifies your Conan recipe reference formatted <NAME>/<VERSION>@<USER>/<CHANNEL>