Reputation: 1966
I see that when I create a custom task type in gradle, with different package name than 'org.gradle', I cannot directly declare the task in my build file with just type name. I need to give fully qualified name of the task
If the package is 'foo.bar' then
task blockC(type: TestNGBlock) {
testngxml = "tests/testng-lrga-blockC.xml"
}
doesnt' work. I need to write as below:
task blockC(type: foo.bar.TestNGBlock) {
testngxml = "tests/testng-lrga-blockC.xml"
}
Is there a way like import in java, where I can specify gradle the package names to look into for resolving type, so that I can use the former approach to define task.
Upvotes: 2
Views: 850
Reputation: 84786
Yes. Import in build.gradle
works exactly the same as in pure java class.
import foo.bar.TestNGBlock
task blockC(type: TestNGBlock) {
testngxml = "tests/testng-lrga-blockC.xml"
}
Upvotes: 5