[英]rebar: Missing application directory
我正在測試螺紋鋼
我從github代碼編譯了rebar並創建了一個基本應用程序
$ mkdir testapp; cd testapp
$ mkdir rel
$ rebar create-app appid=testapp
$ echo "{sub_dirs, ["rel"]}." > rebar.config
$ cd rel
$ rebar create-node nodeid=testnode
$ cd -
$ rebar compile
$ rebar generate
ERROR: generate failed while processing testapp/rel: {'EXIT',{{badmatch,{error,"testapp: : Missing application directory."}
...
我讀了reltool文件,但我不能找到有關應用程序目錄的任何唯一的相關選項是incl_cond
,但默認是通過定義rebar
命令
{application, testapp,
[
{description, ""},
{vsn, "1"},
{registered, []},
{applications, [
kernel,
stdlib
]},
{mod, { testapp_app, []}},
{env, []}
]}.
{sys, [
{lib_dirs, []},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "testapp", "1",
[
kernel,
stdlib,
sasl,
testapp
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "testapp"},
{profile, embedded},
{incl_cond, derived},
{mod_cond, derived},
{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, testapp, [{mod_cond, app}, {incl_cond, include}]}
]}.
{target_dir, "testapp"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/testapp", "bin/testapp"},
{copy, "files/testapp.cmd", "bin/testapp.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"}
]}.
在我的情況下,我不得不修改默認的rel/reltool.config
行
{lib_dirs, []},
至
{lib_dirs, ["../../"]},
我項目的布局是:
Makefile
ebin/
rebar.config
rel/
src/
這可能對你有幫助 。 (如果原始鏈接消失,引用如下)
不完全確定R15B01之后的版本更改的原因是什么。
感謝Siri,R15B01中的reltool包含了一個非常有用的功能。
許多Erlang項目使用以下結構:
./src/foo.app.src
./src/foo.erl
./rel/reltool.config如果要在rel / reltool.config中引用應用程序foo,則以前有三個選項:
* project-local libs /或apps /目錄
*不安全{lib_dirs,“../ ..”} reltool.config設置
* rebar_reltool_link fake_lib_dir插件從R15B01開始,您現在需要做的就是指定
{app,foo,[{incl_cond,include},{lib_dir,“..”}}}
在reltool.config中,不在lib_dirs中的應用程序。雖然R15B01仍在開發中,但此功能已完成,可以在otp.git maint分支中使用。
請參閱此指南, https://github.com/rebar/rebar/wiki/Release-handling
如果您正在使用R15B01或更新,
{app,exemplar,[{mod_cond,app},{incl_cond,include},{lib_dir,“..”}}}
以上提到路徑的方式解決了我找不到應用程序目錄的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.