scalasbtammonite

How to add parameters to run SBT in Ammonite?


I want to run this SBT command in Ammonite:

sbt -mem 3000 clean compile docker:publishLocal

I tried a few things like:

%.sbt("-mem 3000", 'clean, 'test)(pwd)

Which gives this exception:

[error] Expected symbol
[error] Not a valid command: -
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected 'addPluginSbtFile'
[error] -mem 3000
[error]  ^

How is this done?


Solution

  • I recently had to the same thing, and i can tell you that is not fun when those "random" errors happen.

    // I had to put the full path where sbt is, like this
    val SBT = "C:\\Program Files (x86)\\sbt\\bin\\sbt.bat"
    
    %(SBT, "-mem", "3000", "clean", "compile", "docker:publishLocal")(pwd)
    

    with this the solution is:

    %.sbt("-mem", "3000", 'clean, 'test)(pwd)