Search code examples
scalaintellij-ideaplayframeworksbt

Intellij, run play framework app in a given port


I have a Scala app with Play Framework. To run the app I can open a terminal, run sbt and then:

run

This will run the app on port 9000 (default port). If I want to run on a different port, let's say in port 9001 in sbt I can do:

run 9001

What if I want to do the same in Intellij? I can create a new Configuration, click on sbt task and in Tasks: enter run. This will run the app in port 9000.

If instead of just run I put run 9001 (like when running within sbt) the app keep using the port 9000.

So my question is how can I start on a different port using sbt task in Configurations?


Solution

  • If you were to run it from CLI (not in SBT console), you would write it sbt "run 9001" because run 9001 is a single command from SBT point of view.

    IntelliJ expects it the same way: "run 9001".