rebar: Missing application directory
Asked Answered
C

3

5

I'm testing rebar on

  • Windows 8 64Bis
  • Erlang 64bits R15B02

I've compiled rebar from github code and created a basic app

$ 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

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"}
          ]}.
Corey answered 21/11, 2012 at 2:39 Comment(0)
W
4

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.

Thanks to Siri, reltool in R15B01 includes a really useful feature.

Many Erlang projects are using the following structure:
./src/foo.app.src
./src/foo.erl
./rel/reltool.config

When you wanted to reference the application foo in rel/reltool.config, you previously had three options:
* project-local libs/ or apps/ directory
* unsafe {lib_dirs, "../.."} reltool.config setting
* rebar_reltool_link fake_lib_dir plugin

Starting with R15B01 all you have to do now is specify
{app, foo, [{incl_cond, include}, {lib_dir, ".."}]}
in reltool.config for applications not in lib_dirs.

Although R15B01 is still in development, this feature is complete and can be used in the otp.git maint branch.

Workable answered 21/11, 2012 at 6:55 Comment(0)
R
7

In my case I had to modify the default rel/reltool.config line

   {lib_dirs, []},

to

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

Where the layout of my project is:

Makefile
ebin/   
rebar.config
rel/    
src/
Radiochemistry answered 6/10, 2013 at 9:48 Comment(0)
W
4

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.

Thanks to Siri, reltool in R15B01 includes a really useful feature.

Many Erlang projects are using the following structure:
./src/foo.app.src
./src/foo.erl
./rel/reltool.config

When you wanted to reference the application foo in rel/reltool.config, you previously had three options:
* project-local libs/ or apps/ directory
* unsafe {lib_dirs, "../.."} reltool.config setting
* rebar_reltool_link fake_lib_dir plugin

Starting with R15B01 all you have to do now is specify
{app, foo, [{incl_cond, include}, {lib_dir, ".."}]}
in reltool.config for applications not in lib_dirs.

Although R15B01 is still in development, this feature is complete and can be used in the otp.git maint branch.

Workable answered 21/11, 2012 at 6:55 Comment(0)
P
1

Refer this guideline, https://github.com/rebar/rebar/wiki/Release-handling

If you're using R15B01 or newer change,

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

above way of mentioning path solved the application directory not found issue for me.

Paddlefish answered 11/2, 2015 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.