I have myerlib/src/myerlib.erl erlang library module and I need call its functions from Elixir modules. Too call myerlib module functions from elixir code I could write :myerlib.function(.....) but
If I put myerlib subrirectory under deps/ elixir directory and use mix.exs:
def deps do
[
{:myerlib, path: "deps/myerlib"}
# ...
]
end
then when I do iex -S mix
I get this error:
*** (Mix) :path option can only be used with mix projects, invalid path dependency for :myerlib
If you have a src
directory with .erl
files in it then they will be compiled when you run mix.compile
(either with mix compile
or implicitly with something like iex -S mix
).
You can see this in the mix compile.erlang task. This can be the default path src
, but this can be changed by modifying the erlc_paths
option in your mix.exs
file.
def project do
[app: :my_app,
version: "0.0.1",
elixir: "~> 1.0",
erlc_paths: ["foo"], # ADD THIS OPTION
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end
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