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.
Supported Features
Proxy, Hosted, and Group for Conan 2.0 repositories
Nexus Repository provides limited support for Conan 1.x
Support for Conan 1.x
No support for Group repositories Nexus Repository does not have a Conan 1.x implementation for group repositories, but it does support a Conan 1.x proxy and hosted repositories.
Conan 1.x CLI client with revisions disabled You cannot use a Conan 1.x CLI client with revisions disabled to interact with a Conan 2.0 repository.
Conan 1.x CLI client with revisions enabled To use a Conan 1.x CLI client with revisions enabled, you must configure a Conan 2.0 repository.
Conan 2.0 Client with Conan 1.x proxy The Conan 2.x CLI client throws an error when using a Conan 1.0 proxy repository. Use a Conan 1.0 proxy repository with the Conan 1.x client
Support for Conan 2.0
Conan 2.0 brings major changes, especially in creating package IDs, making them more reliable. Recipes need updates, and there's a new command-line interface.
Keep Conan 1.x and 2.0 packages apart Conan 1.x uses a static package ID based on settings, options, and dependencies. This could lead to collisions and ambiguity, especially with complex dependency graphs.
Conan 2.0 introduces a dynamic package ID that considers the package's type and dependencies' types. This results in more accurate and meaningful IDs, improving build reproducibility and reducing conflicts.
Learn more on the Conan Migration Documentation.
Recipe Format and Compatibility Conan 2.0: Emphasizes a more declarative and streamlined recipe format. This improves readability and maintainability.
Command-Line Interface (CLI) Conan 1.x has a different command set than 2.0. Conan 2.0 redesigned CLI has improved consistency and usability. Some commands were renamed or replaced, requiring updates to scripts and workflows.
The CLI command Conan inspect is experimental and subject to breaking changes
Learn more from the Conan Inspect documentation.
Implications for Nexus Repository You must use separate repositories in Nexus for Conan 1.x and 2.0 packages to avoid conflicts and ensure proper indexing. If you're migrating from Conan 1.x to 2.0, plan for a phased approach, updating recipes and client configurations gradually.
Search Parameters Added in Version 3.74.0
Additional search parameter support was 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 need to run the “Repair - Rebuild repository search
“ task before the new search fields are indexed for existing Conan Hosted repositories.
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.
Requires Nexus Repository with PostgreSQL database
Applies to Hosted Conan repositories
Add the Conan Bearer Token Realm
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.
The Conan version cannot be changed after creating the repository.
Create a proxy repository
Minimal configuration steps are as follows:
Define a name for the proxy
Select the Conan version
Define a URL for remote storage
https://center.conan.io
is the defaultSelect a blob store for the repository
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:
Add the certificate to
<user_home>/.conan/cacert.pem
Enable the Conan Bearer Token Realm
Navigate to Administration → Security → Realms
Add the
Conan Bearer Token Realm
Hosted Conan Repository
Conan-hosted repositories require an H2 or PostgreSQL database. Complete the following steps to set up a Conan-hosted repository:
Create a new hosted Conan repository in Nexus Repository
Enable the Conan Bearer Token Realm
Navigate to Administration → Security → Realms
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 protocolfalse
: 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>/.*")