Cannot import class in build.gradle file

I have made a custom gradle plugin project in eclipse. I build this project with gradle. In the root of my project I have my build.gradle file where I would like to include a class that I have made in the same project (src/com/

apply plugin: 'groovy'
apply plugin: 'maven'
    repositories {
  dependencies {
  compile gradleApi()
  groovy localGroovy()
  compile 'commons-io:commons-io:2.4'
import com.MyClass;

But I get the error:

unable to resolve class import com.MyClass

How do import my own classes in the root build file? I have looked at this post:

which indicates that I need to inform the build script that it needs ‘this’ project but I am not sure how to.

See the “Organizing Build Logic” chapter in the Gradle User Guide. You can decide between 53.3 and 53.5. Another option is to declare a (Groovy) class right in the build script.