钢筋使用时如何处理? [英] How to handle deps while using rebar to release?
问题描述
我使用 rebar生成
来处理发布,但是当我启动
应用程序时,我使用的deps将不会被找到。 >
我可以使用 erl -pa ./ebin ./deps/*/ebin -s myapp
手动启动应用程序。 / p>
我想知道如何配置 rebar.config
和 reltool.config
来处理
依赖关系?谢谢。
为了使reltool生成包含依赖关系的版本,您需要将它们添加到 reltool.config
。我有一个名为 drill_instructor
的应用程序,它具有以下 reltool.config
。像 {app,stdlib,[{incl_cond,include}]},
之类的行告诉reltool在发行版中包含该应用程序。我还添加了deps到 lib_dirs
设置。
{sys,
{lib_dirs,[../deps]},
{erts,[{mod_cond,derived},{app_file,strip}]},
{app_file,strip},
{rel,drill_instructor,1,
[
内核,
stdlib,
sasl,
crypto,
ranch,
jiffy,
牛仔,
jiffy,
drill_instructor
]},
{rel,start_clean,,
[
stdlib
]},
{boot_rel,drill_instructor},
{profile,embedded},
{incl_cond,exclude},
{excl_archive_filters,[。*]},%%不归档建立的libs
{excl_sys_filters,[^ bin /.*,^ erts。* / bin /(dialyzer | typer) ,
^ erts。* /(doc | info | include | lib | man | src)]},
{excl_app_filters,[\.gitignore]},
{ app,sasl,[{incl_cond,include}]},
{app,crypto,[{incl_cond,include}]},
{app, stdlib,[{incl_cond,include}]},
{app,kernel,[{incl_cond,include}]},
{app,cowboy,[{incl_cond,include}]},
{app,ranch,[{incl_cond,include}]},
{app,jiffy,[{incl_cond,include}]},
{app,drill_armory,[{incl_cond,include}]} ,
{app,drill_instructor,[{incl_cond,include},{lib_dir,..}}}
]}。
{target_dir,drill_instructor}。
{overlay,[
{mkdir,log / sasl},
{copy,files / erl,\ {\ {erts_vsn\} \} / bin / erl},
{copy,files / nodetool,\ {\ {erts_vsn\} \} / bin / nodetool},
{copy ,file / drill_instructor,bin / drill_instructor},
{copy,files / drill_instructor.cmd,bin / drill_instructor.cmd},
{copy,files / start_erl cmd,bin / start_erl.cmd},
{copy,files / install_upgrade.escript,bin / install_upgrade.escript},
{copy,files / sys.config ,release / \ {\ {rel_vsn\} \} /sys.config},
{copy,files / vm.args,releases / \ {\ {rel_vsn\\ \\} \} /vm.args}
]}。
在rebar.config中,我还添加了rel作为 sub_dir
:
{sub_dirs,[rel]}。
I'm using rebar generate
to handle release, but when I start the
application, the deps I use will not be found.`
I can start the application manually using erl -pa ./ebin ./deps/*/ebin -s myapp
.
I'm wonder how to config rebar.config
and reltool.config
to handle
dependencies? Thanks.
In order for reltool to generate a release which includes the dependencies, you will need to add them to reltool.config
. I have an application called drill_instructor
, which has the following reltool.config
. The lines like {app, stdlib, [{incl_cond, include}]},
tell reltool to include that application in the release. I also added deps to the lib_dirs
setting.
{sys, [
{lib_dirs, ["../deps"]},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "drill_instructor", "1",
[
kernel,
stdlib,
sasl,
crypto,
ranch,
jiffy,
cowboy,
jiffy,
drill_instructor
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "drill_instructor"},
{profile, embedded},
{incl_cond, exclude},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]},
{app, sasl, [{incl_cond, include}]},
{app, crypto, [{incl_cond, include}]},
{app, stdlib, [{incl_cond, include}]},
{app, kernel, [{incl_cond, include}]},
{app, cowboy, [{incl_cond, include}]},
{app, ranch, [{incl_cond, include}]},
{app, jiffy, [{incl_cond, include}]},
{app, drill_armory, [{incl_cond, include}]},
{app, drill_instructor, [{incl_cond, include}, {lib_dir, ".."}]}
]}.
{target_dir, "drill_instructor"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/drill_instructor", "bin/drill_instructor"},
{copy, "files/drill_instructor.cmd", "bin/drill_instructor.cmd"},
{copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
{copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
{copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
{copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
]}.
In the rebar.config, I also added rel as a sub_dir
:
{sub_dirs, ["rel"]}.
这篇关于钢筋使用时如何处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!