ojinari
Hex - is there a way to use a completely local dependency in a Elixir project?
Is there a way to use a completely local dependency in a Elixir project? A dependency shouldn’t be uploaded to any git cloud hosting including a private cloud repository at github, gitlab and so on.
Marked As Solved
kokolegorille
You can use path dependency… it allows to use a dependency relative to main application path (or absolute path).
Also Liked
dimitarvp
Local path dependencies are described here: https://hexdocs.pm/mix/Mix.Tasks.Deps.html
wojtekmach
For cases like that, I’d sometimes do the following:
defp deps() do
[
ecto: ecto_dep()
]
end
defp ecto_dep() do
if path = System.get_env("ECTO_PATH") do
{:ecto, path: path}
else
{:ecto, "~> 3.0"}
end
end
addstar
Figured it out. If you’re using path dep and dont want to have to start stop your phoenix app to have changes reflected you just need to add the path to elixirc_paths in mix.exs e.g.
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib", "/Path/to/dependency"]
ericmj
You can modify files in deps/ and then run mix deps.compile APP to recompile it.
ericmj
In the case where I need to actually make changes to a dependency I like that I need to explicitly declare it as a path dependency. It’s very little work compared to making a PR and with an explicit dep I cannot accidentally commit changes to the project without updating the dep or reverting changes that depend on my local checkout changes.







