Could not create plugin of type 'UploadGradlePlugin' for custom plugin


I am new to Gradle and trying to create a new plugin. I am using Gradle 2.6 I am applying from similar solution to here:

Error message I am getting is quite generic. I really appreciate if you suggest any troubleshooting steps. I don’t really know what is wrong?


  • What went wrong:
    A problem occurred evaluating root project ‘java’.

Failed to apply plugin [id ‘org.tts’]
Could not create plugin of type ‘UploadGradlePlugin’.

My build.gradle script from consumer project:

buildscript {
    repositories {
        maven {
            url uri('../../../../repo')

    dependencies {
        //Custom plugin class path. Group=com.testdependencies, artifactId=ttsclient, version=0.0.1-BUILD-SNAPSHOT 
        classpath 'com.testdependencies:ttsclient:0.0.1-BUILD-SNAPSHOT'

apply plugin: 'org.tts'

task uploadJacocoDump(type: org.ttsgradle.UploadGradleTask) {
    println("running consumer task!")

build.gradle file from publisher script:

apply plugin: 'maven'

repositories {
    maven {
            url uri('../repo')

group = 'com.testdependencies'
version = '0.0.1-BUILD-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8

configurations {
    compile.extendsFrom json

dependencies {
    json group: 'org.glassfish', name: 'javax.json', version: '1.0.4'
    compile group: 'org.jacoco', name: 'org.jacoco.core', version: ''
    compile group: 'org.testng', name: 'testng', version: '6.8.7'
    testCompile group: 'org.powermock', name: 'powermock-module-testng', version: '1.6.2'
    testCompile group: 'org.powermock', name: 'powermock-api-easymock', version: '1.6.2'
    testCompile group: 'org.easymock', name: 'easymock', version: '3.3.1'
    testCompile group: '', name: 'guice', version: '4.0'
    compile files(gradleApi().source.findAll {"gradle") })
    compile files(gradleApi().source.findAll {"groovy") })

jar {
    manifest { 
        attributes "Main-Class": "org.tts.client.TestIQ",
                   "Class-Path": "javax.json-1.0.4.jar"

task fatJar(type: Jar, dependsOn: ['createPom']) {
    group = 'build'
    description = 'Assembles a jar archive containing the main classes and all dependent classes.'
    jar.dependsOn << fatJar
    manifest { 
        attributes "Main-Class": "org.tts.client.TestIQ"
    baseName = + '-all'
    from (sourceSets.main.output.classesDir)
    from (configurations.json.collect {zipTree(it)})

test {

    jacoco {
        // Exclude all testlogic.jar packages
        excludes = [

jacocoTestReport {
    afterEvaluate {
        classDirectories = files(classDirectories.files.collect {
            fileTree(dir: it, exclude: [

task createPom << {
    pom {
        project {
            groupId 'com.testdependencies'
            artifactId 'ttsclient'
            version "$version"

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: uri('../repo')) 

What’s in your src/main/resources/META-INF/gradle-plugins/ file for the plugin project? it needs to be a fully qualified class name.

Does UploadGradlePlugin implement Plugin<Project>?

Thank you Sterling for your response. contents:

where org.tts.client.ttsgradle is the package name that contains the class UploadGradlePlugin.

UploadGradlePlugin implements Plugin:

package org.tts.client.ttsgradle;

import org.gradle.api.Project;
import java.util.List;
import org.gradle.api.Plugin;

public class UploadGradlePlugin implements Plugin < Project > {
	private List<String> listOfExecs;
	 * Constructor
	 * @param listOfExecs
	public UploadGradlePlugin(List<String> listOfExecs)
		this.listOfExecs = listOfExecs;
	public void apply(Project target) {

Ah, your plugin class needs to have a default constructor. Gradle handles creating instances of the plugin.

You usually do configuration on Extension (or Task) objects, not on the plugin itself.

Thanks a lot, Sterling. I finally get a successful build.