Calling compileJava task

Is it possible to call the compileJava task passing the srcDir and outputDir as parameters?..

I suppose you could parameterize the compileJava task by overwriting/configuring it, and by using Gradle properties that you’d pass in on the command line.

But I’d question why you’d want to do this instead of setup sourceSets to match up with each srcDir: