Question: how to create custom standalone RuleSource plugin?


(Hoobajoob) #1

This is my first attempt to create a standalone plugin project for an internal repository, and I’d like to use the RuleSource style implementation, using groovy only.

My problem is that I’m getting this warning below on the jar task when I build the project:

:compileJava UP-TO-DATE
:pluginDescriptors
:processResources
:classes
:jar
:jar: A valid plugin descriptor was found for com.myCompany.gradle.myPlugin.properties but the implementation class com.myCompany.gradle.plugins.MyRuleSource was not found in the jar.
:assemble
:pluginUnderTestMetadata
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build


BUILD SUCCESSFUL

I’m starting with just an empty RuleSource subclass which I’ve placed in <root>/src/main/groovy/com/myCompany/gradle/plugins/MyPlugin.groovy:

package com.opentext.gradle.plugins;

class ReleaseCycle extends RuleSource {
}

I have no other files in the project other than those needed for the gradle wrapper and build.gradle:

plugins {
    id 'java-gradle-plugin'
    id 'maven-publish'
}

version = '1.0.0-SNAPSHOT'

gradlePlugin {
    plugins {
        myPlugin {
            id = 'com.myCompany.gradle.myPlugin'
            implementationClass = 'com.myCompany.gradle.plugins.MyRuleSource'
        }
    }
}

publishing {
    repositories {
        maven {
            credentials {
                username "..."
                password "..."
            }
            url "http://artifactory.mycompany.net/plugin-repo"
        }
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.14'
}

What am I doing wrong?


(Hoobajoob) #2

Ok - duh.

build.gradle is missing the groovy plugin. Should have been able to tell the groovy file wasn’t getting compiled, because it shouldn’t have been able to resolve RuleSource without the corresponding import statement.

I’m back on track now…