Skip to main content

Conan Repositories

Conan is a package manager for C/C++ projects with a client-server architecture. Conan allows encapsulation of C/C++ project dependencies, distribution, and consumption in other projects. This involves the complex challenges of transitive dependencies, versioning, and licensing. Conan works across Linux, OSX, and Windows platforms.

New Search Parameters Added in Version 3.74.0

New search parameter support has been added to Conan Hosted repositories in Nexus Repository version 3.74.0. These parameters are extracted from the conaninfo.txt settings and are used when Searching for Components in the user interface and through the REST API.

Existing users will need to run the “Repair - Rebuild repository search“ task before the new search fields are indexed for existing Conan Hosted repositories.

Supported Features:
  • Proxy and Hosted repositories (requires Pro license for hosted)

  • Requires Conan version 1 either with or without revisions

Conan Revisions

Conan revisions are a feature in the Conan dependency and package manager that allows users to make changes to artifacts while maintaining a single Conan reference.

The goal of revisions is to make packages immutable so that they are never overwritten. This allows for reproducible builds and dependencies. Lockfiles can capture the exact state of a dependency graph, including versions and revisions, and can be used to force the use of those versions and revisions, even if new ones are uploaded to the servers. 

Recipe revisions

A unique ID (revision) is associated with each Conan recipe export. When a recipe is changed, a new recipe revision (RREV) is created.

Package revisions

A new package revision (PREV) is calculated for each new package created. The PREV is based on the hash of the package contents. Multiple package revisions can belong to a single recipe revision, but the same package ID can't have multiple revisions that belong to different recipe revisions. 

  1. Require Nexus Repository Pro with PostgreSQL database

  2. Applies to Hosted Conan repositories

  3. Add the Conan Bearer Token Realm

  4. Enable revisions for Conan as in the Conan documentation

Proxy Conan Repository

Steps to set up a proxy repository to access a remote repository location

  1. Create a proxy repository

    1. Minimal configuration steps are as follows:

      1. Define a name for the proxy

      2. Define a URL for remote storage

        https://center.conan.io is the default

      3. Select a blob store for the repository

  2. If you will use HTTPS protocol for Conan and your Nexus Repository is configured to use a self-signed certificate, add your certificate to the trusted list:

    1. Add the certificate to <user_home>/.conan/cacert.pem

  3. Enable the Conan Bearer Token Realm

    1. Navigate to Administration → Security → Realms

    2. Add the Conan Bearer Token Realm

Hosted Conan Repository

Conan-hosted repositories require a Nexus Repository Pro license with an H2 or PostgreSQL database

Complete the following steps to set up a Conan-hosted repository:

  1. Create a new hosted Conan repository in Nexus Repository as documented in Repository Management.

  2. Enable the Conan Bearer Token Realm

    1. Navigate to Administration → Security → Realms

    2. Add the Conan Bearer Token Realm

Below is an example of using a hosted Conan repository:

    conan remote add conan-hosted $HOSTED_REPO_URL
    conan remote login [repo user] -p [repo password]
    conan new hello/0.1
    conan create . hello/world
    conan upload hello/0.1@hello/world --all -r=conan-hosted

Browsing Conan Repositories and Searching Packages

You may browse Conan repositories in the user interface inspecting the components and assets and their details, as described in Browsing Repositories and Repository Groups.

Searching for Conan packages may be performed in the user interface as well. Find packages in the repository manager, as described in Searching for Components.

Conan Client

These instructions detail how to configure the Conan Client with Nexus Repository.

Delete the Default Remotes

Delete the default remotes to avoid bypassing the Conan repository and stop packages from installing directly from remote servers.

Use the following command where <remote name> is the remote's name:

conan remote remove <remote name>

Use the following to delete the default remote:

conan remote remove conan-center
Add a New Remote to the Nexus Repository

To add a new remote with a link to the Conan repository, use the following command:

conan remote add <remote name> <remote URL> <SSL flag>
remote name

the Conan repository name

remote URL

the Conan repository URL

SSL flag
  • true: enable HTTPS protocol

  • false: enable HTTP protocol

The following command adds a Conan proxy repository with the name conan-proxy:

conan remote add conan-proxy http://localhost:8081/repository/conan-proxy/ false
Update the Remote to the Nexus Repository

The following command changes the remote configuration (changes the remote URL or enables/disables SSL):

conan remote update <remote name> <remote URL> <SSL flag>

You can review a list of configured remotes by using the following command:

conan remote list

Content Selectors for Conan

When configuring content selectors for a Conan repository you need to use two paths in the definition.

/repository/conan-releases/v1/conans/<package-name>/<version>/<user>/<stable>/upload_url

/repository/conan-releases/conans/<user>/<package-name>/<version>/<stable>/conanmanifest.txt
or
/repository/conan-releases/conans/<user>/<package-name>/<version>/<stable>/conanfile.py

Example content selector for a Conan-hosted repository:

format == "conan" and (path =~ ".*/<package-name>/.+/<user>/<stable>/.*" or path =~ ".*/<user>/<package-name>/.+/<stable>/.*")