How can I build an umbrella project into escript?

Elixir: 1.8.1

I have just started a project using umbrella with two small apps, for example, app A and app B and defined the main/1 function in A.App. Then I added escript: [main_module: A.App] to the top mix.exs and run mix escript.build but mix says:

** (Mix) Could not generate escript, please set :main_module in your project configuration (under :escript option) to a module that implements main/1

I cannot find a way to solve it. Can I build an umbrella project into one escript file?

One of your applications in the umbrella is going to have to be the escript application. Presumably the other will be a library? From what you’ve given, I think you need to put the escript definition in the mix.exs file for application A.

3 Likes

Thank you! I solved this problem perfectly.