3
votes

I am coming from the assumption that the deps folder of an erlang project should include symbolic links that point to other projects and applications, so all modules from that project can be accessed/visible.

For example, My project named project_final should access modules from project_a and application_b. The directory structure of them is as follows:

NOTICE: because I am using GIT, the projects have a double structure, so they are not direct siblings to each other, but instead they are placed under /projects/project_X/projectX/etc... I believe this is a problem. Any better suggestions how to manage this ?

/projects/project_a/project_a : contains ( ebin, include, src ) /projects/application_b/application_b : contains ( ebin, include, src )

/project/pro_final:

  • deps : has symbolic links that point to project_a and application_b
  • ebin
  • include
  • src : contain modules that use project_a and applicabion_b module's functions, but gives exception error: undefined function.

How I am executing the project_final test module is by:

cd /projects
erl -env ERL_LIBS "."
myprojectfinalmodule:test().
** exception error: undefined function project_a:test/0

The project_a:test module is exported and correct.

1
RichardC's recommendation to not use deps ( use a lib dir instead ) if I am not using rebar is to be followed. Although in the issue above, to be resolved, I was able to run properly using an additional common path to ERL_LIB such as ERL_LIBS ".:./myprojectname/deps" where deps ( or 'lib' whatever you wanna call it ) is a common parent to all related applications and projects.gextra

1 Answers

7
votes

The deps directory is a Rebar convention, and should probably not be managed in any other way except through Rebar. If you're not using Rebar, don't put dependencies in a subdirectory of the application, put your individual applications under a common lib/ directory instead and use the ERL_LIBS environment variable (see http://erlang.org/doc/man/code.html) to tell Erlang where to look for applications.