In sbt you can do this:
sbt test-project/compile
And it will run the compile command on just the test-project project.
Note that this is based on the IDs of the projects in the build.sbt, not their paths. You may, for instance have “test_project” on the filesystem.
If you’re using the sbt repl, you may also need to do “reload” if you’ve recently changed the build.sbt.