Could not find property 'classesDir' on source set main

You could probably use

sourceSets.main.output.classesDir

instead. Works for test.