SBT: how to initiate separate actions when changing files in two separate subprojects

My build.sbt as follows:

 val client = project.in(file("client")) val server = project.in(file("server")) 

The main project consists of two separate projects: client and server. I would like to develop them at the same time: I need both of them to be created and the server to work when I work. Each project has its own additional build steps: client needs packageJS after compilation, while server requires container:restart .

However, doing ~; restartServer; restartClient ~; restartServer; restartClient ~; restartServer; restartClient from the root directory does not do what I want, since it listens on any subproject and always restarts both of them, and in my case it causes a restart cycle, since one subproject uploads files to another subproject for use.

Is it really necessary to do "~ restartXXX" in both subprojects at the same time, so I can edit any of them and it will only restart the edited project?

+7
scala sbt
source share
1 answer

Have you tried: ~ all restartServer restartClient .

In sbt 0.13.2-M2 (and I think sbt 0.13.1, but not sure), there is a new all command that will run the given tasks in parallel. In combination with ~, you can ensure that several tasks are performed when changing.

+2
source share

All Articles