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.
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 to use your repository as a source to install packages and as a target for export (upload packages).
Local vs. Remote
Don't let Conan terminology confuse you. For this integration, the Conan "Remote" is actually the Artifactory local repository you created for Conan packages.
In the sections below, <REMOTE> denotes the logical name you set with which the Conan client can identify the Conan local repository in Artifactory.
Add Your Repository
Conan V2 Client
The instructions below apply for Conan client versions 2 and above- to use previous versions of the Conan client, see the Conan documentation.
To use your local repository with Conan, you first need to add it as a Conan "Remote" to the client as follows:
Note
Make sure to replace your placeholders in bold with your own remote name, your JFrog domain URL, and Artifactory repository key
conan remote add <REMOTE> https://<YOUR_JFROG_DOMAIN>/api/conan/<REPOSITORY_KEY>
For example:
conan remote add my-artifactory-repo https://john.jfrog.io/api/conan/conan-local
Conan repositories must be prefixed with api/conan in the path
When accessing a Conan repository through Artifactory and using a command not copied from the Set Me Up instructions, 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
Accessing Artifactory anonymously
If Artifactory is configured for anonymous access, you may skip authenticating the Conan client.
To authenticate the Conan client to Artifactory, log in using the following command:
Note
Make sure to replace your placeholders in bold with your own remote name, username, and password
conan remote login <REMOTE> <USERNAME> -p <PASSWORD>
For example:
conan remote login my-artifactory-repo johnf -p LEBoBAkwtvbwB6q
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 the following command:
Note
Make sure to replace your placeholders in bold with your own remote name
conan install . -r <REMOTE>
For example:
conan install . -r my-artifactory-repo
Upload Packages
To upload packages to your Artifactory local Conan repository, use the following command:
Note
Make sure to replace your placeholders in bold with your own remote name and pattern to the package, folder, or recipe that you want to upload. To upload a recipe, format it in the following way: <NAME>/<VERSION>@<USER>/<CHANNEL>
conan upload <PATTERN> -r <REMOTE>
For example:
conan upload "*" -r my-artifactory-repo