【问题标题】:rebar: Missing application directoryrebar:缺少应用程序目录
【发布时间】:2012-11-09 05:57:47
【问题描述】:

我正在测试钢筋

  • Windows 8 64Bis
  • Erlang 64 位 R15B02

我已经从 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 命令定义

src/testapp.app.src

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

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

【问题讨论】:

    标签: erlang rebar reltool


    【解决方案1】:

    This might help you(如果原始链接消失,请在下面引用)

    虽然不完全确定 R15B01 之后的版本更改的原因是什么。

    感谢 Siri,R15B01 中的 reltool 包含一个非常有用的功能。

    许多 Erlang 项目都使用以下结构:
    ./src/foo.app.src
    ./src/foo.erl
    ./rel/reltool.config

    当你想引用应用程序 foo 时 rel/reltool.config,你之前有三个选项:
    * 项目本地 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 分支中使用。

    【讨论】:

      【解决方案2】:

      就我而言,我必须修改默认的rel/reltool.config

         {lib_dirs, []},
      

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

      我的项目布局在哪里:

      Makefile
      ebin/   
      rebar.config
      rel/    
      src/
      

      【讨论】:

        【解决方案3】:

        参考本指南, https://github.com/rebar/rebar/wiki/Release-handling

        如果您使用的是 R15B01 或更新的更改,

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

        以上提及路径的方式为我解决了应用程序目录未找到的问题。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-04-03
          • 2023-03-13
          • 2013-07-27
          • 1970-01-01
          • 2018-10-25
          • 1970-01-01
          • 2017-01-11
          • 1970-01-01
          相关资源
          最近更新 更多