Referencing a gradle plugin in a subproject for integration testing

I have a multi project gradle build where I have a regular old plugin with some helper classes and a gradle “template” plugin that adds some extra tasks. I build the two plugins and then I have a test project that I would like to apply the plugins that I created earlier in the build.

I have installed the plugins into the local maven repository and I can see that they are installed properly. In my test project I have the script below.

I was hoping that the build script part would pick up the plugins from maven and add them to my classpath.

buildscript {

repositories {



maven {

url ‘



dependencies {

classpath group: ‘com.magnet.gradle’, name: ‘magnet-plugin’,

version: ‘0.1’

classpath group: ‘com.magnet.gradle’, name: ‘magnet-templates’,

version: ‘0.1’

} }

plugins {

id “maven”

id “com.magnet.gradle.templates” version “0.1”

id “com.magnet.gradle.magnet” version “0.1” }

dependencies {

testCompile project(":magnet-templates")


You are using the wrong syntax for applying your plugins. The ‘plugins {…}’ block is only to be used for core Gradle plugins and those registered in the Gradle Plugin Portal. If you are retrieving your plugins from a Maven repository you’ll want to use the ‘apply()’ syntax.

apply plugin: ‘com.magnet.gradle.templates’

apply plugin: ‘com.magnet.gradle.magnet’

Perfect, thanks! One other thing that I needed to do was to separate out that project from the top level project so that I could build the project prior to the plugins being built.