I have used reabr3 to create an application to practice the RabbitMQ but the rebar3 can not load the additional file I created in the src
folder to erlang shell.
I used rebar3 new app rabbit
. I had rabbit_app.erl rabbit_sup.erl and rabbit.app.src
and a new defined file named hello_world.erl
in the src/
directory. I ran the rebar3 compile
to compile and get dependencies.
Then ran rebar3 shell
to able to test the function in hello_world.erl
. The hello_world.beam
can not be loaded so I have to use the c(hello_world)
manually in erlang shell. It is a bit inconvenient.
Any helps would highly be appreciated. Here is the console output for rebar3 compile
and rebar3 shell
.
$ rebar3 compile
===> Verifying dependencies...
===> Fetching amqp_client v3.8.14
===> Fetching rabbit_common v3.8.7
===> Fetching credentials_obfuscation v2.2.0
===> Fetching jsx v2.11.0
===> Fetching lager v3.8.0
===> Fetching ranch v1.7.1
===> Fetching recon v2.5.1
===> Fetching goldrush v0.1.9
===> Analyzing applications...
===> Compiling credentials_obfuscation
===> Compiling goldrush
===> Compiling jsx
===> Compiling lager
===> Compiling ranch
===> Compiling recon
===> Compiling rabbit_common
===> Compiling amqp_client
===> Analyzing applications...
===> Compiling rabbit
$ rebar3 shell
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling rabbit
Erlang/OTP 22 [erts-10.7.2.1] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe]
Eshell V10.7.2.1 (abort with ^G)
1> ===> Booted xmerl
===> Booted compiler
===> Booted sasl
===> Booted syntax_tools
===> Booted tools
===> Booted goldrush
===> Booted lager
===> Booted jsx
===> Booted ranch
===> Booted recon
===> Booted credentials_obfuscation
===> Booted rabbit_common
===> Booted amqp_client
===> Booted rabbit
[UPDATE] I found that the new added files were load but the auto-complete for these files did not work. I had to use the whole command for the first time.
rebar3
organizes the.beam
files in directories outside thesrc
directory. When you issue the commandc(hello_world)
, the.beam
file is placed in the current directory. Apparently, you are issuing yourrebar3
commands while the current directory is thesrc/
directory, which is not the way things are done withrebar3
. You need to be in therabbit/
directory, i.e. the top level directory of yourapp
, when you issuerebar3
commands likerebar3 compile
andrebar3 shell
.