1

I've noticed that in the latest version of xsbt the jetty container gets forked and passing system properties no longer works.

I was looking for a simple way to pass a port number via system property when launching sbt in order to set the port for the jetty container. It's not clear if this is possible or not.

Also, I'm running into a problem for local development because it is impossible to pass options to the container now. I'm not sure how to change out settings quickly and conveniently without being able to do this. Is there a reason that the forked java process can't inherit or be passed the system props?

Also just curious what the reason is for needing the container to run in a forked process in the first place.

jpswain
  • 14,642
  • 8
  • 58
  • 63

1 Answers1

0

I've noticed that in the latest version of xsbt the jetty container gets forked and passing system properties no longer works.

To pass JVM system properties to the forked process, you can use either the containerForkOptions setting:

containerForkOptions := new ForkOptions(runJVMOptions = Seq("-Dh2g2=42"))

Or you can use javaOptions in Jetty:

javaOptions in Jetty += "-Dh2g2=42"

I was looking for a simple way to pass a port number via system property when launching sbt in order to set the port for the jetty container. It's not clear if this is possible or not.

There are a couple ways to do this. You can use the containerPort setting:

containerPort := 9090

Or you can pass arguments directly to jetty-runner:

containerArgs := Seq("--port", "9090")

Also just curious what the reason is for needing the container to run in a forked process in the first place.

See https://github.com/earldouglas/xsbt-web-plugin/issues/136

earldouglas
  • 13,265
  • 5
  • 41
  • 50