0
votes

I'm new in both Elixir and Phoenix. Currently I have some concern regarding downloading or using library from private or local mix project. Let say my lib project name is: my_custom_mix_app and its an OTP app using gen_server. And I want it to be able to do just like below snippet from my phoenix app.

defp deps do
    [{:phoenix, "~> 1.2.1"},
    {:phoenix_pubsub, "~> 1.0"},
    {:phoenix_ecto, "~> 3.0"},
    {:mariaex, ">= 0.0.0"},
    {:phoenix_html, "~> 2.6"},
    {:phoenix_live_reload, "~> 1.0", only: :dev},
    {:gettext, "~> 0.11"},
    {:cowboy, "~> 1.0"},
    {:my_custom_mix_app, "~> 1.0"]
end

Well since I came from Java background, I can do that by using Maven or Gradle, even if the lib project happens to be in my local drive, and not registered in any remote Maven repo.

How can I do that in Elixir?

P.S. I checked this article regarding creating Elixir deps, but it doesn't solve my concern on a non registered lib project

Thanks.

2

2 Answers

2
votes

There two ways to use internal app dependency

umbrella

defp deps do
    ...
    {:my_app, in_umbrella: true}
end

non-umbrella

defp deps do
    ...
    {:my_app, path: "path/to/the/app"}
    {:my_app_git, git: "https://repo.com/my/app.git}
end

Well documented here https://hexdocs.pm/mix/Mix.Tasks.Deps.html

0
votes

You can provide the local path to your project by adding a path: key like so:

defp deps do
    ...
    {:my_custom_mix_app, path: "path/to/the/app"}
end