Managing Conan with JFrog CLI

JFrog Applications and CLI Documentation

 

The JFrog CLI provides integration with the native Conan C/C++ package manager, enabling you to run Conan commands while collecting build information for Artifactory.

When you use jf conan commands (for example, jf conan install and jf conan create), the CLI acts as a transparent wrapper that executes the native Conan binary directly.

Conan runs in Native Mode by default. The CLI passes all arguments directly to the native Conan client without modification.

There is no Wrapped Mode for Conan.

Mode of Operation

Native Mode (Default)

In Native Mode, the JFrog CLI executes the upstream Conan client directly. All Conan configuration, including remotes, profiles, and credentials, must be set up using standard Conan commands.

The CLI provides the following capabilities:

  • Build-info collection when --build-name and --build-number are provided

  • Transparent pass-through of all Conan arguments

Command Reference

Syntax

jf conan <conan subcommand> [conan arguments] [command options]
    

All native Conan subcommands are supported.

Common Subcommands

Subcommand

Description

install

Install package dependencies

create

Create a package from a recipe

build

Build a package locally

export

Export a recipe to the local cache

upload

Upload packages to a remote

search

Search for packages

remote

Manage remotes

profile

Manage profiles

Command Options

Flag

Description

Default

--build-name

Build name for build-info collection. Requires --build-number.

None

--build-number

Build number for build-info collection. Requires --build-name.

None

--module

Optional module name for the build-info.

None

--project

JFrog Project key for the build-info.

None

Prerequisites

Before using JFrog CLI with Conan, ensure the following prerequisites are met.

  1. JFrog CLI is installed

    See the JFrog CLI Installation Guide.

  2. Conan 2.x is installed

    JFrog CLI supports Conan 2.x only.

    • pip install conan

    • brew install conan

  3. JFrog CLI is configured with your Artifactory instance

    jf c add myserver \
      --url=https://mycompany.jfrog.io \
      --user=<USERNAME> \
      --password=<PASSWORD>
    
    jf c use myserver
            
  4. A Conan repository exists in Artifactory

    Create a Conan repository (local, remote, or virtual) in Artifactory before configuring it as a Conan remote.

Workflow

Step 1: Configure Conan Remotes

Configure Artifactory as a Conan remote using native Conan commands.

conan remote add artifactory https://mycompany.jfrog.io/artifactory/api/conan/conan-local
conan remote login artifactory <USERNAME> -p <PASSWORD>
    

Step 2: Install Dependencies

jf conan install . --build=missing \
  --build-name=my-conan-build \
  --build-number=1
    

Step 3: Create a Package

jf conan create . --name=mypackage --version=1.0 \
  --build-name=my-conan-build \
  --build-number=1
    

Step 4: Upload to Artifactory

jf conan upload mypackage/1.0@* --remote=artifactory --confirm \
  --build-name=my-conan-build \
  --build-number=1
    

Step 5: Publish Build-Info

jf rt bp my-conan-build 1
    
Examples

Install Dependencies with Build-Info

jf conan install . --build=missing \
  --build-name=cpp-app \
  --build-number=42
    

Create and Upload a Package

jf conan create . --name=hello --version=1.0 \
  --build-name=hello-build \
  --build-number=1

jf conan upload hello/1.0@* -r=artifactory -c \
  --build-name=hello-build \
  --build-number=1

jf rt bp hello-build 1
    

Search for Packages

jf conan search "*" --remote=artifactory
    
Conan 2.x Compatibility

JFrog CLI supports Conan 2.x. The CLI detects and uses whichever version of Conan is installed in your environment.

jf conan install . --build=missing \
  --build-name=conan2-build \
  --build-number=1

jf conan create . \
  --build-name=conan2-build \
  --build-number=1
    
Frequently Asked Questions

Q: Why do I use jf conan instead of conan?

A: Using jf conan allows you to run standard Conan commands while automatically collecting build-info in Artifactory.

Q: Does jf conan modify my Conan configuration?

A: No. The CLI runs the native Conan client without modification.

Q: Is there a jf conan-config command?

A: No. Conan in JFrog CLI runs in Native Mode only.

Q: Can I use Conan with JFrog Projects?

A: Yes. Use the --project flag to associate build-info with a JFrog Project.