本文档翻译自:https://docs.conan.io/en/latest/reference/commands/misc/alias.html
$ conan alias [-h] reference target
创建并导出“别名软件包配方”。
“别名”程序包是另一个程序包(目标)的符号名称(引用)。 当某些程序包依赖别名时,将检索并使用目标程序包,因此别名引用(符号名)不会出现在最终依赖关系图中。
positional arguments:
reference Alias reference. e.g.: mylib/1.X@user/channel
target Target reference. e.g.: mylib/1.12@user/channel
optional arguments:
-h, --help show this help message and exit
命令:
$ conan alias hello/0.X@user/testing hello/0.1@user/testing
使用以下内容为hello/0.X@user/test
创建并导出软件包配方:
from conans import ConanFile
class AliasConanfile(ConanFile):
alias = "hello/0.1@user/testing"
此类包装配方可作为别名参考的“代理”。 取决于hello/0.X@user/testing
的用户实际上将使用hello/0.1@user/testing
版本。 别名包引用将完全不会出现在依赖关系图中。 定义符号名称或诸如“始终取决于最新的次要名称”之类的行为很有用,但是要在上游定义而不是在version-ranges
下游定义。
“别名”软件包应采用与常规软件包配方相同的方式上载到服务器,以便能够从服务器使用。