Hi
I have some trouble to test a custom task with Gradle TestKit and Spock.
According the documentation the classpath of the test process can be injected with the Java Gradle Plugin Development Plugin. But it does seem to work for plugins only and not with custom task.
I need to import the custom task with an import statement:
buildFile << """
import org.catais.dmt.task.validation.IlivalidatorTask
task validateFile(type: IlivalidatorTask) {
fileName = "${xtfFileName}"
xtflog = true
}
"""
But this ends with a “unable to resolve class” error. The only thing that helps is the approach for Gradle versions prior to 2.8: https://docs.gradle.org/current/userguide/test_kit.html#sec:working_with_gradle_versions_prior_to_28
I’m a bit confused if it’s the right approach of if I’m missing something. Should the Java Gradle Plugin Development Plugin not also work with Custom Tasks? Any hints or ideas?
best regards
Stefan