Hi
i have a custom plugin that exposes certain tasks and methods. I apply the plugin and can call any of its task or method from my main build file but When i try to do the same in an external build script, it cannot load the custom methods but its able to run the tasks fine.
Main Build file
//build.gradle
apply plugin: 'MyCustomPlugin'
import com.MyCompany.gradle.UtilityMethods
task MainBuildFileTask << {
UtilityMethods.PrintFileContent(project,"SomeFile.txt")
}
gradle MainBuildFileTask => It works gradle customTask => It works
but if i move this code to an external buil script that i include in the main script it doesnt work
//ExternalScript.gradle
apply plugin: 'MyCustomPlugin'
import com.MyCompany.gradle.UtilityMethods
task externalScriptTask << {
UtilityMethods.PrintFileContent(project,"SomeFile.txt")
}
//build.gradle
apply from: 'ExternalScript.gradle'
gradle externalScriptTask => It doesnt work
calling custom task from the plugin works gradle customTask => It works
It complains, '> Could not find property ‘UtilityMethods’ on task ':externalScriptTask ‘.’
I have tried playing with where i do the ‘apply plugin’ and ‘import’ steps and even using the fully qualified name with no luck. any help is greatly appreciated
Cheers Ipoo Doh