`compileOnly` should also work for tests though.
# gradle
k
compileOnly
should also work for tests though.