When would it be appropriate to specify a dependency only in deps
in my mix.exs
and not as a runtime dependency in applications
?
I thought that applications
are actual applications that need to be started before my own application can be started, but I run into a problem where exrm
wasn't putting the Jazz
library (which I think only contains pure functions) into the release until I included :jazz
in applications
.
An OTP application is more like a component - a bunch of modules and functions that may (but need not) run some processes. If an OTP app doesn't start its own supervision tree, it is called a library application. Either way, if you use some of libs functions at runtime, you need to specify it as a runtime dep.
In contrast, compile-time dependency only ensures that the 3rd party code is fetched and available locally (on your dev/build machine). This is useful if the 3rd party code does its magic outside of runtime. An example could be my own ExActor or pure Erlang meck mocking library. In the first case ExActor does its magic during compilation, while in the second case you need the mocking library only during tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With