How to compile tests with SBT without running them

user1809090 picture user1809090 · Dec 12, 2012 · Viewed 19.3k times · Source

Is there a way to build tests with SBT without running them?

My own use case is to run static analysis on the test code by using a scalac plugin. Another possible use case is to run some or all of the test code using a separate runner than the one built into SBT.

Ideally there would be a solution to this problem that applies to any SBT project. For example, Maven has a test-compile command that can be used just to compile the tests without running them. It would be great if SBT had the same thing.

Less ideal, but still very helpful, would be solutions that involve modifying the project's build files.

Answer

Guillaume Massé picture Guillaume Massé · Dec 12, 2012

Just use the test:compile command.