简体   繁体   English

钢筋:缺少应用程序目录

[英]rebar: Missing application directory

I'm testing rebar on 我正在测试螺纹钢

  • Windows 8 64Bis Windows 8 64Bis
  • Erlang 64bits R15B02 Erlang 64bits R15B02

I've compiled rebar from github code and created a basic app 我从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."}
...

I'm reading the reltool documentation but i cant found anything about application dir the only relevant option is incl_cond but is defined by default by rebar command 我读了reltool文件,但我不能找到有关应用程序目录的任何唯一的相关选项是incl_cond ,但默认是通过定义rebar命令

src/testapp.app.src SRC / testapp.app.src

{application, testapp,
 [
  {description, ""},
  {vsn, "1"},
  {registered, []},
  {applications, [
                  kernel,
                  stdlib
                 ]},
  {mod, { testapp_app, []}},
  {env, []}
 ]}.

rel/reltool.config 相对/ reltool.config

{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"}
          ]}.

In my case I had to modify the default rel/reltool.config line 在我的情况下,我不得不修改默认的rel/reltool.config

   {lib_dirs, []},

to

   {lib_dirs, ["../../"]},

Where the layout of my project is: 我项目的布局是:

Makefile
ebin/   
rebar.config
rel/    
src/

This might help you . 这可能对你有帮助 (quoted below in case the original link disappears) (如果原始链接消失,引用如下)

Not exactly sure what's the reason for that change for versions following R15B01 though. 不完全确定R15B01之后的版本更改的原因是什么。

Thanks to Siri, reltool in R15B01 includes a really useful feature. 感谢Siri,R15B01中的reltool包含了一个非常有用的功能。

Many Erlang projects are using the following structure: 许多Erlang项目使用以下结构:
./src/foo.app.src ./src/foo.app.src
./src/foo.erl ./src/foo.erl
./rel/reltool.config ./rel/reltool.config

When you wanted to reference the application foo in rel/reltool.config, you previously had three options: 如果要在rel / reltool.config中引用应用程序foo,则以前有三个选项:
* project-local libs/ or apps/ directory * project-local libs /或apps /目录
* unsafe {lib_dirs, "../.."} reltool.config setting *不安全{lib_dirs,“../ ..”} reltool.config设置
* rebar_reltool_link fake_lib_dir plugin * rebar_reltool_link fake_lib_dir插件

Starting with R15B01 all you have to do now is specify 从R15B01开始,您现在需要做的就是指定
{app, foo, [{incl_cond, include}, {lib_dir, ".."}]} {app,foo,[{incl_cond,include},{lib_dir,“..”}}}
in reltool.config for applications not in lib_dirs. 在reltool.config中,不在lib_dirs中的应用程序。

Although R15B01 is still in development, this feature is complete and can be used in the otp.git maint branch. 虽然R15B01仍在开发中,但此功能已完成,可以在otp.git maint分支中使用。

Refer this guideline, https://github.com/rebar/rebar/wiki/Release-handling 请参阅此指南, https://github.com/rebar/rebar/wiki/Release-handling

If you're using R15B01 or newer change, 如果您正在使用R15B01或更新,

{app, exemplar, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]} {app,exemplar,[{mod_cond,app},{incl_cond,include},{lib_dir,“..”}}}

above way of mentioning path solved the application directory not found issue for me. 以上提到路径的方式解决了我找不到应用程序目录的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM