Mix Run in IntelliJ?

I’m using the IntelliJ-Elixir plugin here:

While compile seems to work, I’ve had no luck setting up a run configuration to execute, "mix run ".

I’ve tried:
run $FileName$
run $FilePath$/$FileName$
run $FileDir$/$FileName$
run $FileDirRelativeToProjectRoot$
run $FileDirRelativeToProjectRoot$/$FileName$
run $FileRelativePath$
run $FileRelativePath$/$FileName$

No matter the configuration I get the error:
** (Mix) No such file:

When I put in the full file path for that particular file, it finds it. When trying to use parameters it doesn’t find it.

How do I setup IntelliJ to run the current Elixir file without having to type the run command manually?

Hi, I maintain IntelliJ Elixir, but the original mix support was from another contributor, so I’m not familiar with all the code can do.

I’m going to assume that $ parameters aren’t supported, but please open a feature request (Issues · KronicDeth/intellij-elixir · GitHub) to have them added.

I setup all my mix tasks manually. iIn general, you can take the part after mix that you’d run on the commandline and just paste it in the Command input in the Configuration dialog.

I just now setup a mix run configuration specifically as I remembered we use that to run our seeds:

If you want more automated creation, please open feature requests. I didn’t know about those $ parameters before. I know there are two issues open already related to run configurations:

  1. Environment variables (Allow environment variables to be set for Mix Run Configuration · Issue #216 · KronicDeth/intellij-elixir · GitHub)
  2. Test configurations (Testing workflow · Issue #427 · KronicDeth/intellij-elixir · GitHub)
1 Like