diff --git a/guide/docs/setup/gradle.md b/guide/docs/setup/gradle.md index a5cfa79f..02940b78 100644 --- a/guide/docs/setup/gradle.md +++ b/guide/docs/setup/gradle.md @@ -1,5 +1,7 @@ The following code snippets can be used in your `build.gradle.kts` file. +An example of a final configuration file [is also available](gradle_example.md). + ## Gradle configuration ### Java version diff --git a/guide/docs/setup/gradle_example.md b/guide/docs/setup/gradle_example.md new file mode 100644 index 00000000..a7679a58 --- /dev/null +++ b/guide/docs/setup/gradle_example.md @@ -0,0 +1,32 @@ +An example for a `build.gradle.kts` file of a project using KSpigot would be: + +```kotlin +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + kotlin("jvm") version "1.5.10" +} + +group = "net.axay" +version = "1.0-SNAPSHOT" + +repositories { + mavenCentral() + maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots") +} + +dependencies { + compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") + implementation("net.axay:kspigot:1.17.1") +} + +tasks { + compileJava { + options.release.set(16) + options.encoding = "UTF-8" + } + compileKotlin { + kotlinOptions.jvmTarget = "16" + } +} +``` diff --git a/guide/mkdocs.yml b/guide/mkdocs.yml index 01e2ac18..55e3d828 100644 --- a/guide/mkdocs.yml +++ b/guide/mkdocs.yml @@ -33,6 +33,7 @@ nav: - Requirements: setup/beginners.md - Starting a new project: setup/project.md - Setup using Gradle: setup/gradle.md + - Build script example: setup/gradle_example.md - Entrypoint to your plugin: setup/entrypoint.md - Extensions: - Event listener: extensions/listener.md