Search code examples
elixirelixir-mixelixir-iex

iex- How to run an elixir project from outside the app folder


I have some situation,
in which i need to run an elixir project, from outside the project file.
i.e. i have a folder code/example-app that contains the app (with the mix.exs and all the rest) and i would like to run that app from code,
without cd-ing into example-app.
Is there a way to do that ?


Solution

  • You can specify the location of the mix.exs file using the MIX_EXS environment variable.

    MIX_EXS=./code/example-app/mix.exs mix deps.get
    

    You can read more about the environment variables that affect mix in the documentation.

    Just note that if you try to execute a task that is defined inside of the project or one of its dependencies, it will not work.