Buildscript dependency in init.gradle


(m m) #1

Is it possibly to define the build script dependencies in init.gradle instead of the individual project build files ?


(René Groeschke) #2

yes that’s possible. you can use the allprojects block for that:

allprojects{
    buildscript{
        ...
        ...
    }
}

cheers, René


(m m) #3

Thanks. I am trying to use the jrebel plugin which is needed for all the projects. In my init.gradle , I have the below setting and it works

allprojects {
            apply plugin: 'maven-publish'
     apply plugin: 'java'
            apply plugin: 'eclipse'
     apply plugin: 'groovy'
buildscript {
 repositories {
    mavenCentral()
    // This repo is optional, as since version 1.1.2, we also always deploy to Maven central.
    // Be aware that it could take a bit of time (couple of hours) before a published new
    // version will appear in the central repository.
    mavenRepo(
   name: 'zt-public-snapshots',
   url: 'http://repos.zeroturnaround.com/nexus/content/groups/zt-public/'
    )
 }
     dependencies {
    classpath group: 'org.zeroturnaround', name: 'gradle-jrebel-plugin', version: '1.1.2'
 }
  }
}

and in the individual project build.gradle I have the below configuration

apply plugin: 'rebel'

Actually i dont want the individual projects to apply the rebel plugin . Looks like I can do the build script configuration for the plugin in init.gradle but still it has to be applied in the individual project.

If I try to apply jrebel ( similar to java plugin ) within init.gradle I get an error , plugin with id ‘rebel’ not found.


(m m) #4

is this related to http://issues.gradle.org/browse/GRADLE-2407 ?

Since Rebel plugin is not used in production , We dont want all the build.gradle in the SVN to have the rebel plugin. Thats the reason we are trying to move it out to init.gradle


(Luke Daley) #5

Yes, that’s effectively the bug stopping this from working.