Curious mismatch between Build file behavior and API behavior

Hi, I am building a Gradle Plugin for NetKernel which does some sophisticated handling wrt to class and source definitions. The first step is to look within the project dir for both. I have the remapping working in a build file, but moving it into a plugin is causing some pain. The JavaDocs don’t show the classesDir being available here, but the build file still works.

Can someone clarify why this works:

sourceSets {

main {

java {

classesDir = projectDir

}

} }

But this doesn’t work in code?

project.sourceSets.main.java.classesDir = project.projectDir

Thanks.

The Javadoc does show a getClassesDir() method. What error message/stack trace do you get?

I must be missing something in how this applies programmatically, but I got it to work. Thanks.