NOTE: You can open this sample inside an IDE using the https://www.jetbrains.com/help/idea/gradle.html#gradle_import_project_start[IntelliJ native importer] or https://projects.eclipse.org/projects/tools.buildship[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 https://guides.gradle.org/building-kotlin-jvm-libraries/[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.

====
include::sample[dir="groovy",files="build.gradle[]"]
include::sample[dir="kotlin",files="build.gradle.kts[]"]
====

To build the library:

[listing.terminal.sample-command]
----
$ ./gradlew jar

BUILD SUCCESSFUL
3 actionable tasks: 3 executed
----

For more information, see link:https://kotlinlang.org/docs/reference/using-gradle.html[building a Kotlin project with Gradle reference].

You can also generate this project locally using link:{userManualPath}/build_init_plugin.html#sec:kotlin_library[`gradle init`].
