'rebar generate'不包括生成的版本中的某些依赖项

时间:2012-02-24 15:28:32

标签: erlang rebar

我有一个奇怪的问题,即使用钢筋构建我正在使用的erlang应用程序的版本。从本质上讲,它似乎无法找到安装在我系统上的erlang thrift客户端。我可以通过从erlang提示符加载thrift应用程序来验证这一点:

$ erl
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]

Eshell V5.8.5  (abort with ^G)
1> application:load(thrift).
ok
2> application:loaded_applications().
[{kernel,"ERTS  CXC 138 10","2.14.5"},
 {thrift,"Thrift bindings","0.9.0-dev"},
 {stdlib,"ERTS  CXC 138 10","1.17.5"}]
3> 

但是,当我试图运行'螺纹钢生成'为了构建我的应用程序的版本,它失败了:

$ rebar generate
==> rel (generate)
{"init terminating in do_boot","Release fern uses non existing application thrift"}

Crash dump was written to: erl_crash.dump
init terminating in do_boot (Release fern uses non existing application thrift)

这是我的应用程序文件fern.app.src:

{application, fern, [
  {description, "elided"},
  {vsn, "0.5.0"},
  {modules, [
    fern_app,
    fern_sup,
    accounts_repository,
    fern_http_request,
    fern_system_api,
    metadata_fetcher,
    metadata_process,
    repository,
    repository_server,
    timestamps_repository,
    hbase_thrift,
    hbase_types,
    utils
  ]},
  {registered, [
    fern_sup
  ]},
  {applications, [
    kernel,
    stdlib,
    inets,
    ssl 
  ]},
  {mod, { fern_app, []}},
  {env, []},
  {agner, [
    {requires, ["jiffy", "meck", "mochiweb"]}
  ]}
]}.

...和我的reltool.config:

{sys, [
       {lib_dirs, ["../apps", "../deps"]},
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "fern", "1",
        [
         kernel,
         stdlib,
         sasl,
         ssl,
         inets,
         thrift,
         fern
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "fern"},
       {profile, embedded},
       {incl_cond, exclude},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/.*", "^erts.*/doc", "^erts.*/src",
                           "^erts.*/info", "^erts.*/man",
                           "^erts.*/lib", "^erts.*/include",
                           "^erts.*/bin/(dialyzer|typer)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, sasl,   [{incl_cond, include}]},
       {app, stdlib, [{incl_cond, include}]},
       {app, kernel, [{incl_cond, include}]},
       {app, inets,  [{incl_cond, include}]},
       {app, crypto, [{incl_cond, include}]},
       {app, public_key, [{incl_cond, include}]},
       {app, ssl,    [{incl_cond, include}]},
       {app, thrift, [{incl_cond, include}]},
       {app, fern, [{incl_cond, include}]}
      ]}.

{target_dir, "fern"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "files/fern", "bin/fern"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/fern.cmd", "bin/fern.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.

我应该注意,如果我从两个应用程序列表中删除thrift,则发布会生成,但不包含thrift库,因此在运行时会失败。任何人都可以向我提供有关我在这里做错的指导吗?

非常感谢,

1 个答案:

答案 0 :(得分:4)

为了遇到这个问题的其他人 - 我最终解决了这个问题。出于某种原因,rebar将'thrift'应用程序重命名为'thrift-0.9.0-dev'。将上述配置中原子'thrift'的所有实例更改为'thrift-0.9.0-dev'(注意这是一个原子,而不是字符串 - 使用单引号)将其排序。