Sbt proposal: Ability to configure jvm options for bsp server which is run over bsp/sbt.json

Currently(sbt 1.4.1) if sbt is not run manually the work on a large project is not possible with bsp.

if bsp server is not run intelliji idea will run it by the following command(from .bsp/sbt.json):

usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xms100m -Xmx100m -classpath /usr/share/sbt/bin/sbt-launch.jar xsbt.boot.Boot --bsp

The running server always uses the default jvm options:

ps -a -o pid,user,%mem,command | grep java
76504 admin     5.3 java -Xms2048M -Xmx2048M -Xss2M -jar /usr/share/sbt/bin/sbt-launch.jar

So a compilation for a large project is not possible because of out of memory.

I have tried to use:

  • JAVA_OPTS
  • SBT_OPTS
  • build.sbt(sbt Reference Manual — Forking)
    Global / javaOptions += "-Xmx8G"
    Zero / javaOptions += "-Xmx9G"
    run / javaOptions += "-Xmx10G"
    javaOptions += "-Xmx11G"
    

Currently I have not managed to find a work solution.
It seems that sbt must always be run manually currently.