Gradle 2.12 - Injecting plugins into sub-projects fails


(Hristo Stoyanov) #1

I have a standard Gradle setup with a root and sub-projects. In my root build.gradle, I would like to configure a plugin and inject it into some of the sub-projects, e.g:

project(':web-app'){    
    apply plugin: 'gwt'    
    buildscript {
        repositories {
            jcenter()
            maven { url 'http://dl.bintray.com/steffenschaefer/maven'}
        }
        dependencies {
            classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
        }
    }
    gwt {
      //Shared stuff goes in here ...
    }
}

Unfortunately, I am getting:

A problem occurred evaluating root project ‘XXXX’. Plugin with id
’gwt’ not found.

What am I doing wrong? If I do the same in the sub-project(s) build.gradle, it works.

Bonus questions, if the above works at all:

  1. How do I inject in several sub-projetcs? Seems like project(':web-app',':shared'){...} does not work if used above.
  2. If the sub-project also has gwt{...} block, will it be merged with the stuff injected from the root? If so what takes precedence?

Thanks


(Schalk Cronjé) #2

buildscript goes outside of the project block.


(Hristo Stoyanov) #3

Thanks

/Hristo Stoyanov