Class defined in a gradle file not visible when imported


(Baiyan Huang) #1

I have a class defined in base.gradle named BaseClass, and I apply this base.gradle in my build.gradle:

apply from: 'base.gradle'
  def b = new BaseClass()

But gradle report: build.gradle’: 30: unable to resolve class BaseClass

Is there a way to make the class visible when applied?

Thanks.


(Peter Niederwieser) #2

The best solution is to move the class into ‘$rootDir/buildSrc/src/main/groovy/BaseClass.groovy’.