groovy - How to use buildscript dependencies in custom classes? -


i using couple of helper classes build script, folder structure looks like

buildsrc       -src         -main            -groovy            gitutils.groovy build.gradle 

in gitutils trying import couple of classes (from grgit & http-builder in example) used in custom library. not work, "unable resolve class xxx" exceptions. these classes resolved fine if in build.gradle.

relevant part of build.gradle:

buildscript {       repositories {     jcenter()     mavencentral()   }   dependencies {     classpath 'org.ajoberstar:grgit:1.3.0'     classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1'   } }  dependencies {   compile 'org.ajoberstar:grgit:1.3.0'   compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' }  ... gitutils.dostuff(); 

the clean solution declare dependencies have in gutils in buildsrc/build.gradle file:

apply plugin:'groovy'  repositories {   jcenter()   mavencentral() } dependencies {   compile gradleapi()   compile 'org.ajoberstar:grgit:1.3.0'   compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' } 

Comments