I would like to launch sbt with a specific port number directly :
sbt run 9001
does not work as 9001 is ignored.
What works however is to first launch sbt
and then use the command run 9001
How could I combine both directly in one command line I could run in my shell ?
With the commit introduced today (Nov 25), you can now specify a port number right after the run or start sbt commands. Show activity on this post. On Windows maybe the play "run 9001" will not work. You have to change the play.bat file. See Ticket Show activity on this post.
By default, sbt server will be running when a sbt shell session is active. When the server is up, it will create a file called the port file. The port file is located at ./project/target/active.json.
When you’re running the SBT run command from your operating system command line, enclose the run command and the command-line parameters in quotes, like this: $ sbt "run foo bar baz". This process also works when there are multiple main methods in your project: $ sbt "run foo bar baz" [warn] Executing in batch mode.
The sbt launcher component is a self-contained jar that boots a Scala application or server without Scala or the application already existing on the system. The only prerequisites are the launcher jar itself, an optional configuration file, and a Java runtime version 1.6 or greater. A user downloads the launcher jar and creates a script to run it.
If I remember well, I think you have to add all the parameters between quotes. In you case:
sbt "run 9001"
When you run sbt
console it's enough to use run 9001
without any quotation marks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With