In one of my projects, I am using the play sbt plugin (addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25"
) and I am facing some issues in a multi-project sbt build. I have created a sample project to reproduce the issue here: https://github.com/rbsamoht/play_sbt_bug
Basically, my root sbt project is composed of 2 subprojects:
- The first, named project1, is a pure Scala project that prints its current working directory and a system variable that I added using the javaOptions variable in the project settings
- The second, named project2, is using the PlayScala plugins an does the same
Expected behavior (project1)
When running: sbt ";clean;reload;project1/run
- the system variables set in javaOptions are available in the project
- the working directory of the project is
./project1
Observed behavior (project2)
The behavior of project2:
When running: sbt ";clean;reload;project2/run
- the system variables set in javaOptions are ignored by the project
- the working directory of the project is the root project when it should be
./project2
Reproduce the issue
Clone the project: git clone https://github.com/rbsamoht/play_sbt_bug.git
Run ./test.sh
Once play is started, curl http://localhost:9000
In project2, the working directory and the custom.property variable are printed on TestController initialization
What could explain why the behavior is different between project1 and project2 ?