rebar.config的依赖包名称问题

本文记录了使用rebar管理Erlang项目时遇到的问题及解决方案,包括调整依赖库配置、解决名称冲突等。

问题出在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,"bad term"}}

原因很可能是,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, ".*", {git, "git://github.com/tonyg/erlang-rfc4627.git", "master"}}
]}.

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

转载于:https://my.oschina.net/u/191928/blog/620331

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值