Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT: Start a command line 'run' of the main class of a non-default project

Tags:

scala

sbt

I am starting to use sbt build my Scala code (and handle dependencies). As far as I know if I use

$ sbt run <args> 

on the command line this will run the main class of the main project.

Is it possible to 'run' within any other project from the command line, i.e. not in the interactive session mode? (I'm thinking about something that might look like $ sbt project <proj> run <args> or whatever...)

What I would do in interactive mode is this:

$ sbt > project <projectname> > run <args> 

This seems to be straightforward enough, but I can not find any documentation describing this behavior. Hints would be much appreciated...

like image 687
fgysin Avatar asked Oct 06 '11 13:10

fgysin


1 Answers

You simply have to quote each command (as in the second example on this page), so in your case it would be:

$ sbt "project foo" "run arg1 arg2" 
like image 63
Moritz Avatar answered Sep 20 '22 09:09

Moritz