# Kotlin Application Sample

version 6.4

- Groovy DSL

- Kotlin DSL

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

This sample shows how a Kotlin application can be built with Gradle. The application has no dependencies aside from the Kotlin standard library and the build has minimal configuration.

build.gradle

    plugins {
        id 'application'
        id 'org.jetbrains.kotlin.jvm' version '1.3.71'
    }

    version = '1.0.2'
    group = 'org.gradle.sample'

    application {
        mainClass = 'org.gradle.sample.app.MainKt'
    }

    repositories {
        mavenCentral()
    }

    dependencies {
        implementation 'org.jetbrains.kotlin:kotlin-stdlib'
    }

build.gradle.kts

    plugins {
        application
        kotlin("jvm") version "1.3.71"
    }

    version = "1.0.2"
    group = "org.gradle.sample"

    application {
        mainClass.set("org.gradle.sample.app.MainKt")
    }

    repositories {
        mavenCentral()
    }

    dependencies {
        implementation(kotlin("stdlib"))
    }

To build and run the application:

    $ ./gradlew run

    > Task :run
    Hello, World!

    BUILD SUCCESSFUL
    2 actionable tasks: 2 executed

For more information, see Application Plugin and building a Kotlin project with Gradle reference.

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