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.
A unique ID (revision) is associated with each Conan recipe export. When a recipe is changed, a new recipe revision (RREV) is created.
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.
Require Nexus Repository Pro 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
Create a proxy repository
Minimal configuration steps are as follows:
Define a name for the proxy
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 a Nexus Repository Pro license with 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 as documented in Repository Management.
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 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
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>
the Conan repository name | |
the Conan repository URL | |
|
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
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>/.*")