# Kotlin Library Sample

version 6.1

- Groovy DSL

- Kotlin DSL

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

If you are new to Gradle and wish to follow a more detailed tutorial for building Kotlin libraries, we suggest you have an look at the Building Kotlin Libraries guide.

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

build.gradle

    plugins {
        id 'org.jetbrains.kotlin.jvm' version '1.3.61'
    }

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

    repositories {
        mavenCentral()
    }

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

build.gradle.kts

    plugins {
        kotlin("jvm") version "1.3.61"
    }

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

    repositories {
        mavenCentral()
    }

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

To build the library:

    $ ./gradlew jar

    BUILD SUCCESSFUL in 1s
    2 actionable tasks: 2 executed

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

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