I want to share code between my projects by creating a library. Once I’ve create a library, how will I go about adding it to my projects?
If I upload it to gitlab to a private repository, will this be possible?
Or if I keep it locally, how will I include it into each of my projects?
Are there other ways?
We put our projects in an umbrella app. There are pros and cons. Perhaps simplest way…
If I upload it to gitlab to a private repository, will this be possible?
Yes, using the :git
options: mix deps — Mix v1.16.0 (see also mix deps.get - Error fetching private repo on GitHub using :github option · Issue #3422 · elixir-lang/elixir · GitHub)
Or if I keep it locally, how will I include it into each of my projects?
Using the :path
options mix deps — Mix v1.16.0 (see example at elixir - using a package locally with hex.pm - Stack Overflow)
Are there other ways?
Umbrella apps
5 Likes
How can I use that with a private repo?
Per https://github.com/elixir-lang/elixir/issues/3422, this should work:
{:app_name, git: "git@github.com:YOUR_ACCOUNT/app_name.git"}
assuming you have SSH keys set up to connect to your private repo.
4 Likes