# Gradle Plugin Sample

version 6.5-milestone-1

- Groovy DSL

- Kotlin DSL

| You can open this sample inside an IDE using the IntelliJ native importer or Eclipse Buildship.

This sample shows how to build a Gradle plugin in the Java language.

build.gradle

    plugins {
        // Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
        id 'java-gradle-plugin'
    }

    repositories {
        // Use jcenter for resolving dependencies.
        // You can declare any Maven/Ivy/file repository here.
        jcenter()
    }

    dependencies {
        // Use JUnit test framework for unit tests
        testImplementation 'junit:junit:4.13'
    }

    gradlePlugin {
        // Define the plugin
        plugins {
            greeting {
                id = 'com.example.plugin.greeting'
                implementationClass = 'com.example.plugin.GreetingPlugin'
            }
        }
    }

build.gradle.kts

    plugins {
        // Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
        `java-gradle-plugin`
    }

    repositories {
        // Use jcenter for resolving dependencies.
        // You can declare any Maven/Ivy/file repository here.
        jcenter()
    }

    dependencies {
        // Use JUnit test framework for unit tests
        testImplementation("junit:junit:4.13")
    }

    gradlePlugin {
        // Define the plugin
        val greeting by plugins.creating {
            id = "com.example.plugin.greeting"
            implementationClass = "com.example.plugin.GreetingPlugin"
        }
    }

For a more guided tour with plugin development, see the guides for plugin development.

You can also generate this project locally using `gradle init`.