When doing a serious refactor in a Java Eclipse project I will often break the build, but focus on getting one test to pass at a time. When running the tests Eclipse warns that the project cannot be compiled, but it will still run the tests it can compile.
Now I’m using SBT and would like to achieve the same thing with ‘test-only’, but it tries to compile the whole project, fails, and doesn’t run the tests. How can I tell it to just compile the bits it can and run the tests.
You should add the following task to your project definition:
This is the same as the ordinary
testtask, but has no dependencies attached at the end. If you’d like it to have dependencies, calldependsOnon thetestTask(...)expression and provide the tasks you want it to depend on.