My application uses Mochiweb. As I understand, rebar
fetches the latest version from Github when I run make
, because there is a line in rebar.config
:
{deps, [
{mochiweb, ".*",
{git, "git://github.com/mochi/mochiweb.git", "master"}}
My application has a VCS and it is git. So, essentially I have one git repository inside another:
myapp
.git
deps
mochiweb
.git
src
etc
I know that adding a git repository inside another one is not a good idea (git add .
). Git submodules functionality should be used instead.
So, I added the deps/mochiweb
directory as a submodule to the main git repository.
The problem is that when another developer clones the main repository he has to init
and update
the submodules first in order to get deps/mochiweb
(otherwise it would be empty).
If the developer just runs make
right after he clones the main repository, the Makefile says the following:
ERROR: Dependency dir deps/mochiweb failed application validation with reason:
{missing_app_file,"deps/mochiweb"}
make: *** [all] Error 1
My question is: What is the proper way of adding another app to the deps of an Erlang app to allow easy updates by the other developers without using git submodules?
What is the proper way of adding another app to the deps of an Erlang app to allow easy updates by the other developers without using git submodules?
Add the app to the rebar.config and use:
./rebar update-deps
For updating. The first time, you need to use:
./rebar get-deps
See: https://github.com/basho/rebar/wiki/Rebar-commands
Now, back to your error.
My feeling is that you have an (almost) empty directory for mochiweb in your deps, probably as a result of playing with Git submodules. When you run the get-deps
command, rebar silently discards mochiweb, since the directory is already there. But it expects an OTP application and looks for the mochiweb.app
file, which is not there (the directory is empty). Therefore, the error. If my interpretation is correct, you can simply do:
rm -rf deps/mochiweb
./rebar get-deps
Having a look to your rebar.config would help, though.