# Gradle Plugin Sample

version 6.2

- 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.12'
    }

    gradlePlugin {
        // Define the plugin
        plugins {
            greeting {
                id = 'org.gradle.sample.plugin.greeting'
                implementationClass = 'org.gradle.sample.plugin.GradlePluginInJavaPlugin'
            }
        }
    }

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.12")
    }

    gradlePlugin {
        // Define the plugin
        val greeting by plugins.creating {
            id = "org.gradle.sample.plugin.greeting"
            implementationClass = "org.gradle.sample.plugin.GradlePluginInJavaPlugin"
        }
    }

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

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