Pass command line arguments to sbt run with ensime.sbt


(Albaro Pereyra) #1


I’d like to pass command line arguments to sbt run by default using the ensime short cuts.

My goal is to press C-c C-b r and run the play framework with the following options by default: -Dconfig.resource=development.conf

I am guessing this can be set on the ensime.sbt but, I am not sure how exactly to do that.

An alternative solution would be to add a lisp hook to ensime.

Please advise,


(Albaro Pereyra) #2

After trying the following:
PlayKeys.devSettings := Seq(“play.server.config.resource” -> “development.conf”)

and being unsuccessful, I realized it might be impossible unless I knew how to overwrite run and add logic to restart it with the options I wanted if they did not exist initially. Since this seem to be over kill for this task.
I tried the ensime approach in the documentation:
(sbt-hydra:system-properties . (
(“macwire” . ("-Dconf.file=myconf.conf" “-Xmx1G”))
(“reader” . ("-Dconf.file=myconf.conf" “-Xmx1G”))))))

Unfortunately this didn’t work either. It gave me an error that was tied to an unrelated windows bug where I ultimately found a solution:
(setq sbt:program-options '("-Dconfig.resource=development.conf"))

This may also be an alternative solution:
export SBT_OPTS=-Dconfig.resource=development.conf