title: How to run an Elixir application?
body: <p>What is the correct way to run an Elixir application?</p>
  
  <p>I'm creating a simple project by:</p>
  
  <pre><code>mix new app
  </code></pre>
  
  <p>and after that I can do:</p>
  
  <pre><code>mix run
  </code></pre>
  
  <p>which basically compiles my app once. So when I add:</p>
  
  <pre><code>IO.puts "running"
  </code></pre>
  
  <p>in <code>lib/app.ex</code> I see <code>"running"</code> only for the first time, each consecutive <code>run</code> does nothing unless there are some changes. What can I do next with generated <code>app.app</code>?</p>
  
  <p>Of course I know I can do:</p>
  
  <pre><code>escript: [main_module: App]
  </code></pre>
  
  <p>in <code>mix.exs</code>, provide <code>def main(args):</code> and then:</p>
  
  <pre><code>mix escript.build
  ./app
  </code></pre>
  
  <p>but's it's kinda cumbersome in my opinion.</p>
  
  <p>There's also something like:</p>
  
  <pre><code>elixir lib/app.exs
  </code></pre>
  
  <p>but it does not count <code>mix.exs</code> obviously, which is needed for dependencies in my <code>app</code>.</p>