Java-gradle-plugin with maven-publish doesn't actually publish any classes


(Malcolm Maude) #1

I’m developing a small gradle plugin as a standalone project and I want to publish it to a maven repo. Problem is, the generated jarfile doesn’t actually have any classes in it.

this is my build.gradle:

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

group 'amrelk.gradle.simulation.learning'
version '0.0.1'

dependencies {
    compile gradleApi()
}

gradlePlugin {
    plugins {
        learningSimulator {
            id = "amrelk.gradle.simulation.learning"
            implementationClass = "amrelk.gradle.simulation.learning.LearningSimulatorPlugin"
        }
    }
}

publishing {
    repositories {
        maven {
            credentials {
                username "****"
                password "****"
            }
            url "https://****"
        }
    }
}

there is definitely a class at amrelk.gradle.simulation.learning.LearningSimulatorPlugin, and it implements Plugin. Basically the only difference between my project and the sample is that mine is written in Groovy.

The jar task outputs :jar: A valid plugin descriptor was found for amrelk.gradle.simulation.learning.properties but the implementation class amrelk.gradle.simulation.learning.LearningSimulatorPlugin was not found in the jar.

Any help would be greatly appreciated


(Stefan Oehme) #2

You probably put your Groovy file in src/main/java. Groovy files belong in src/main/groovy.