There’s a simple way to write the Elixir and Erlang codes under the same umbrella project and you can use them together.
1. Create a new umbrella project
For this example, I’ll create an umbrella project.
2. Create an Elixir project in umbrella
I’ll start off by creating an Elixir project inside the apps
folder.
Now, I’ll add a ping
function inside the PingElixir
module whose only purpose is to print out a message.
3. Create an Erlang project in umbrella
I’ll create an Erlang project using rebar3
also inside the apps
folder.
As for the Elixir project, I’ll also create a module and add a ping
function there.
4. Reference and use the projects above
For this step, I’ll create a new project named ping
where I’ll create a ping
function and call the modules above.
Now, I’ll change the mix.exs
adding the PingElixir
and ping_erlang
modules as umbrella dependencies.
After that, I’ll modify the ping module to call those modules.
5. Running
And as for the testing of the code, it’s pretty simple.
6. Conclusion
It’s a really simple process! Just put the Elixir and Erlang codes together. And with a few lines of code, you’ll get it done.
Check the repo for more.
Thanks!