rebar.config的依赖包名称问题

问题出在rebar,rebar3没测试。

今天用rebar管理项目,在添加一个类库时遇到问题,类库地址为:

https://github.com/tonyg/erlang-rfc4627

rebar.config里面这么写:

{deps,[
	{erlang-rfc4627,".*",{git,"git://github.com/tonyg/erlang-rfc4627.git","master"}},]}.

这样写不行,查了很久,才发现问题出在erlang-rfc4627这个字段。

使用erlang读取文件

$erl
1>file:consult("rebar.config").
{error,{5,erl_parse,"badterm"}}

原因很可能是,erlang中的原子不以-符号连接,erlang-rfc4627可以改名为erlang_rfc4627,或者'erlang-rfc4627'。

改为erlang_rfc4627继续。

获取所有依赖还是失败,失败原因:

{name_mismatch,...
{expected,erlang_rfc4627},{has,rfc4627_jsonrpc}}}.

参考:Respository Name and application name conflicts

这是因为ebin/rfc4627_jsonrpc.app写着:

{application,rfc4627_jsonrpc,...}.

而rebar下载的目录名称erlang_rfc4627, 跟rfc4627_jsonrpc不匹配。

最后改为:

{deps,[
	{rfc4627_jsonrpc,"master"}}
]}.

名称改为app中的项目名称即可。

相关文章

迭代器模式(Iterator)迭代器模式(Iterator)[Cursor]意图...
高性能IO模型浅析服务器端编程经常需要构造高性能的IO模型,...
策略模式(Strategy)策略模式(Strategy)[Policy]意图:定...
访问者模式(Visitor)访问者模式(Visitor)意图:表示一个...
命令模式(Command)命令模式(Command)[Action/Transactio...
生成器模式(Builder)生成器模式(Builder)意图:将一个对...