With the follow code I receive the error: Cannot cast object ‘directory ‘…\build\classes\test’’ with class ‘org.gradle.api.internal.file.AbstractFileCollection$1’ to class ‘org.gradle.api.file.FileTree’
Any Idea how I can clear the FileTree before I add my own content.
But independent of my solution the handling of the FileTree is not optimal in gradle.
That’s too general a statement to discuss meaningfully. Not sure what you are trying to configure, but configuring ‘candidateClassFiles’ is likely the wrong approach.
I suppose you mean to configure which test classes are to be executed? ‘test.include “org/MyTest.class”’ or ‘test.filter.includeTestsMatching “org.MyTest”’. See Gradle Build Language Reference for details.
The test.include and test.includeTestsMatching has only an effect on classes inside of TestClassesDir. But we does not have a TestClassesDir. Our test classes are inside of an jar file.