Conan Repositories
Introduction
Conan is decentralized, portable, extensible and table package manager for C/C++ projects with client-server architecture. Conan allows to encapsulate C/C++ project dependencies, distribute them, and consume them in other projects. This involves the complex challenges of transitive dependencies, versioning, licensing, and so forth. It works across Linux, OSX and Window s platforms.
This format is disabled by default in Nexus Repository Pro HA-C environments.
Supported Features
- Repository types
- Proxy
- Hosted (PostgreSQL and H2 databases only; not supported for OrientDB) PRO NEW IN 3.35.0
Nexus Repository does not currently support the revisions feature introduced in Conan 1.17.
Conan Client Setup
Using the
pip
tool is the recommended way to install the Conan client:
pip install conan
To discover different approaches or any additional details of Conan client installation, see the Conan documentation.
Proxying Conan Repositories
Complete the following steps to set up a Conan proxy repository to access a remote repository location:
- Create a new conan proxy repository as documented in Repository Management
- Minimal configuration steps are as follows:
- Define a Name
- Define a URL for Remote storage (e.g.,
https://center.conan.io
, which is the default) - Select a Blob store for Storage
- Minimal configuration steps are as follows:
- 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
- Note that this is a simple .txt file
- Add the certificate to
- Enable the Conan Bearer Token Realm
- Navigate to Administration → Security → Realms
- Add the
Conan Bearer Token Realm
as described in Realms
Using a Hosted Conan Repository
PRO
Conan hosted repositories will only work with H2 or PostgreSQL databases.
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
as described in Realms
Below is an example of using a hosted Conan repository:
conan remote add conan-hosted $HOSTED_REPO_URL conan user -p admin123 -r conan-hosted admin conan new hello/0.1 conan create . hello/world conan upload hello/0.1@hello/world --all -r=conan-hosted
Conan Client Configuration to Work with Nexus Repository
To avoid bypassing the Conan repository and stop Conan package installation directly from remote servers, delete the default remotes . To delete any remote server, use the following command where <remote name>
is the remote's name:
conan remote remove <remote name>
For example, 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>
<remote name>
is the Conan repository name<remote URL>
is the Conan repository URL<SSL flag>
set to "true
" to enable HTTPs protocol or "false
" to enable HTTP protocol
For example, 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 list of configured remotes by using the following command:
conan remote list
Content Selectors and Conan
When configuring content selectors for a Conan repository, it is necessary to use two paths in your content selector definition as Conan uses the following two paths:
/repository/conan-releases/v1/conans/<package-name>/<version>/<user>/<stable>/upload_urls
/repository/conan-releases/conans/<user>/<package-name>/<version>/<stable>/conanmanifest.txt
or/repository/conan-releases/conans/<user>/<package-name>/<version>/<stable>/conanfile.py
Below is an example content selector for a Conan hosted repository:
format == "conan" and (path =~ ".*/<package-name>/.+/<user>/<stable>/.*" or path =~ ".*/<user>/<package-name>/.+/<stable>/.*")