Use Conan with JFrog CLI
Run native Conan commands with Artifactory integration and optional build-info collection.
When to Use
Use jf conan to run Conan C/C++ package manager commands with Artifactory integration. This enables:
- Resolving Conan packages from Artifactory's Conan repository
- Publishing packages to Artifactory
- Collecting build-info for C/C++ builds
Prerequisites
-
Conan must be installed. Install via pip:
pip install conanVerify with
conan --version. For full installation options, see the Conan installation docs. -
Conan remote configured to point to your Artifactory Conan repository:
conan remote add artifactory https://<your-instance>.jfrog.io/artifactory/api/conan/<repo-name> -
JFrog CLI configured with a server connection. See
jf config add. -
Authentication to Artifactory is required.
-
A Conan project directory containing a
conanfile.pyorconanfile.txt. Thejf conan installcommand works with either file, whilejf conan createrequires aconanfile.py.
Build: jf conan
jf conanRun native Conan commands with Artifactory integration and optional build-info collection.
To run Conan with Artifactory integration:
- Install Conan, configure an Artifactory remote, and open a directory with a
conanfile.pyorconanfile.txt(see Prerequisites). - Run
jf conanwith the Conan subcommand and arguments, adding--build-nameand--build-numberwhen you want build-info (see Build Examples).
Synopsis
jf conan <conan-arguments> [options]
Aliases: none
Arguments
| Argument | Required | Description |
|---|---|---|
<conan-arguments> | Yes | Arguments and options for the Conan command (for example, install, create) |
Build Options
| Flag | Default | Description |
|---|---|---|
--build-name | — | Build name for build-info. Requires --build-number. |
--build-number | — | Build number for build-info. Requires --build-name. |
--module | — | Optional module name for build-info. Requires --build-name and --build-number. |
--project | — | JFrog Artifactory project key |
Build Examples
Note
Run these commands from a directory containing a
conanfile.pyorconanfile.txt. The.argument refers to the current directory where your Conan recipe lives.
View Help
jf conan --helpInstall Dependencies with Build-Info
jf conan install . --build=missing --build-name=<build-name> --build-number=<build-number>Where:
.is the path to the directory containing yourconanfile.pyorconanfile.txt--build=missingbuilds packages from source if pre-built binaries are not available<build-name>is a name for the build (for example,my-cpp-app)<build-number>is a number or identifier for the build run (for example,1)
For example:
jf conan install . --build=missing --build-name=my-cpp-app --build-number=1On success, the output ends with:
Install finished successfully
[Info] Conan build info collected. Use 'jf rt bp my-cpp-app 1' to publish it.
Create a Package
This command requires a conanfile.py (a conanfile.txt is not sufficient for conan create).
jf conan create . --name=hello --version=1.0 --build-name=<build-name> --build-number=<build-number>For example:
jf conan create . --name=hello --version=1.0 --build-name=my-cpp-app --build-number=1On success, the output ends with:
hello/1.0: Package '<package-id>' created
[Info] Conan build info collected. Use 'jf rt bp my-cpp-app 1' to publish it.
Upload Packages to Artifactory
After creating a package, upload it to your Artifactory Conan repository:
jf conan upload "<pattern>" -c -r <remote-name> --build-name=<build-name> --build-number=<build-number>For example:
jf conan upload "hello/1.0" -c -r artifactory --build-name=my-cpp-app --build-number=1Where:
"hello/1.0"is the package reference pattern to upload (use"*"to upload all packages)-cconfirms the upload without prompting-r artifactoryspecifies the remote name configured withconan remote add
Publish Build Info
After uploading, publish the collected build info to Artifactory:
jf rt build-publish <build-name> <build-number>For example:
jf rt build-publish my-cpp-app 1Tip
jf rt bpis a shorthand alias forjf rt build-publish.
Important Notes
- No separate config command: Unlike other build tools, Conan does not have a
jf conan-configcommand. Configure Conan remotes to point to Artifactory using standardconan remote add. - Conan 2.x compatibility: The examples on this page use Conan 2.x syntax. Conan 1.x uses different flags (for example,
--allfor upload), which are not supported in Conan 2.x. Verify your version withconan --versionandjf --version. - Build-info: Use
--build-nameand--build-numberto track dependencies and artifacts. After running your Conan commands, publish the build info withjf rt build-publish <build-name> <build-number>(alias:jf rt bp).
CI/CD Example (GitHub Actions)
# .github/workflows/build.yml
steps:
- uses: actions/checkout@v4
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
- name: Setup Conan
run: |
pip install conan
conan remote add artifactory https://acme.jfrog.io/artifactory/api/conan/conan-local
- name: Install dependencies
run: jf conan install . --build=missing --build-name=my-cpp-app --build-number=${{ github.run_number }}
- name: Upload packages
run: jf conan upload "*" -c -r artifactory --build-name=my-cpp-app --build-number=${{ github.run_number }}
- name: Publish build info
run: jf rt build-publish my-cpp-app ${{ github.run_number }}Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Conanfile not found | No conanfile.py or conanfile.txt in the directory passed to the command | Create a conanfile.py or conanfile.txt in your project directory, or pass the correct path instead of . |
| Conan cannot resolve from Artifactory | Conan remote not configured | Run conan remote add artifactory <artifactory-conan-url> |
| 401 / 403 on upload | Invalid credentials or insufficient permissions | Re-run jf config add; verify conan remote credentials |
unrecognized arguments: --all | Using Conan 1.x flags with Conan 2.x | Replace --all with -c (confirm). See the Conan 2 migration guide. |
| Conan 2.x compatibility issues | CLI version and Conan version mismatch | Check conan --version and jf --version for compatibility |
| Build-info not collected | --build-name and --build-number not passed | Add both flags to the Conan command |
command not found: conan | Conan not installed or not on PATH | Install with pip install conan. If already installed, add the pip scripts directory to your PATH. |
Enable debug logging: export JFROG_CLI_LOG_LEVEL=DEBUG
Related Topics
- Build Tools Overview — Capabilities matrix and tool reference
- Native Mode — Supported packages with Native Mode
Updated 13 days ago
