defp deps do
[
{[.......]},
] ++ private_deps()
end
defp private_deps do
case System.get_env("USE_LOCAL_DEPS") do
"true" ->
# IO.puts("test1") # this will get hit
[
{:lib1, path: "../lib1"}
]
_ ->
# [.........]
[
{:lib1, git: "gitlab url here [.....]"}
]
end
end
I’ll change something in lib1, re-run an application
USE_LOCAL_DEPS=true mix phx.server
and the changes made in lib1 won’t be reflected in it.
This doesn’t work either:
USE_LOCAL_DEPS=true mix deps.update lib1
as it’ll try to fetch all the dependencies from hex.pm
Neither this will
USE_LOCAL_DEPS=true mix deps.get lib1
as the changes in the lib1 still won’t be fetched from “…/lib1”
If it’s a path the package won’t show up in the deps.get output and it won’t be in the deps directory, but run iex or something and you should be able to verify the local dep is available.
I’ve removed _build and deps, recompiled everything – to no avail. The code in deps/lib1 is still the old one
Why does it try to fetch the dependency from gitlab rather than use it locally?
$ USE_LOCAL_DEPS=true mix phx.server
Unchecked dependencies for environment dev:
* lib1 (https://****:****@gitlab.com/my_user123/lib1.git)
the dependency is not available, run "mix deps.get"
** (Mix) Can't continue due to errors on dependencies
In total, it’ll work properly with the dependency at gitlab only.
override: true doesn’t cause the dependency to be recompiled each time, it just overrides conflicts when other packages depend on a different version of the overridden package.
@ojinari What you’re trying to do should work. Maybe there’s a problem somewhere else in your mix.exs. Maybe if you showed the rest of your mix.exs we could help spot the issue. Also I would use USE_LOCAL_DEPS=true mix deps.tree to debug what is happening. With a correctly set up :path dependency you should see output like ├── exsync (~/dev/forks/exsync) (where ~/dev/forks/exsync is the :path).