I am trying to build an OTP release with rebar3. Under the project there are multiple applications. And all those applications will use lager as a logging framework. So I tried the rebar.config like this
{erl_opts, [debug_info,
{i, "apps"}]
}.
{deps, [lager]}.
{relx, [{release, { myrel, "0.0.1" },
[app1,
app2,
sasl]},
{sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"},
{dev_mode, false},
{include_erts, false},
{extended_start_script, true}]
}.
{profiles, [{prod, [{relx, [{dev_mode, false},
{include_src, false},
{include_erts, true},
{system_libs, true}
]}]
}]
}.
The dependence likes this
===> Verifying dependencies...
├─ lager─3.2.1 (hex package)
│ └─ goldrush─0.1.8 (hex package)
├─ app1─1.0.0 (project app)
└─ app2─0.1.0 (project app)
'rebar3 release' looks fine. No error shown.
However, when I run 'rebar3 as prod tar', I found that there is no lager (and goldrush) included the archive (ie. myrel-0.0.1.tar.gz). Therefore when I run it in production system with command 'bin/myrel console', I got the following error..
=ERROR REPORT==== 23-Nov-2016::13:23:01 ===
** Generic server sccp_user terminating
** Last message in was {set,1,undefined}
** When Server state == {su_state,lookup}
** Reason for termination ==
** {'module could not be loaded',
[{lager_config,get,[{lager_event,loglevel},{0,[]}],[]},
.....
Any idea how to solve this ?