Hello,
I’m developing a Gradle Plugin. I have some Groovy classes defined in my plugin. I built the jar for my plugin and am using it in a different project. In my other project, my build.gradle file looks like:
buildscript {
repositories {
// point to my jar file
}
dependencies {
classpath group: 'myGroupName', name: 'myPluginJarName', version: '1.0.0'
}
}
apply plugin: 'myPlugin'
apply from: 'otherFile.gradle'
Now in my plugin, I have the class Foo defined in Groovy. If I try to use class Foo at the end of my build.gradle file, it works fine. However, if I try to use foo in otherFile.gradle, I get “unable to resolve class Foo”. It seems that the buildscript classpath isn’t being applied when you use “apply from:”. Is there a workaround for this?
In otherFile.gradle, I have:
def bar = new Foo(); // You get "unable to resolve class Foo". If you put this at the end of build.gradle (and remove the apply from line), it works.
...
Thanks, Alex