How to add entries to classpath so that the buildSrc plugin can find my files in gradle?

I have a gradle project and am creating a custom plugin to do the extra build work. The source files for the plugin are stored in buildSrc/. I have a basic skeleton, and I see the plugin tasks by running gradle tasks.

The problem I am facing is that I need to add project directories to the class path for plugin tasks.

I tried to add directories using buildscriptmy main build.gradle:

buildscript {
     repositories { mavenCentral() }
     dependencies { 
        classpath files('migrationScripts')
     }   
}

But this does not seem to affect the class path the plugin sees. When I print out the classpath, I get the following:

/home/jharig/project/buildSrc/build/classes/main/
/home/jharig/project/buildSrc/build/resources/main/

How to add

/home/jharig/project/migrationScripts

To the classpath, when is my plugin task done?

: migrationScripts buildSrc/build.gradle.

+4
1

buildSrc/build.gradle /home/jharig/project/migrationScripts compile runtime. , , migrationScripts , buildSrc, buildSrc, .

+4

All Articles