IntelliJ IDEA 2021.2 Help

Compile, Run, Debug

Run Application

In order to run or debug your Erlang application in IntelliJ IDEA, you need do either of the following:

  • Click the Run icon in the editor's gutter next to the main function:

    Quick-running Erlang App

    A temporary ad hoc run/debug configuration will be created on the fly in this case.

  • Open the Run | Edit Configurations dialog from the main menu and add an Erlang Application configuration manually (+). You'll need to specify the configuration's name, define the app's module and function, choose the corresponding IDE project module, fill out other optional fields, and hit OK in the end:

    Installing the Erlang plugin

    After the configuration is created, you will be able to:

    • Run your application from the main menu (Run | Run <configuration name>), navigation toolbar, or using a shortcut Shift+F10

    • Debug your application from the main menu (Run | Debug <configuration name>), navigation toolbar, or using a shortcut Shift+F9

Debug Application

In order to use the IntelliJ IDEA debugger with your Erlang application, you need to:

  1. Make sure the 'Add debug info' option is enabled under Settings/Preferences Ctrl+Alt+S | Compiler | Erlang Compiler

    Erlang Compiler add debug_info
  2. Have an Erlang Application run configuration added to your project.

    It can then be used to debug Shift+F9 your program:

    Erlang Debugger

Run and Build with Rebar

rebar3 commands represent tasks that can be run by the Rebar3 tool.

In IntelliJ IDEA, you can create an Erlang Rebar run configuration for every supported command or a batch of commands:

Passing Rebar Commands to IDE

If you want to build your project using the rebar3 compile command rather than the Build | Build Project default IntelliJ IDEA action, make sure to enable the following option:

  • Settings/Preferences Ctrl+Alt+S | Build, Execution, Deployment | Compiler | Erlang Compiler |'Compile project with rebar'

    Compile project with Rebar
Last modified: 02 August 2022