Add an example for a build.gradle.kts file

This commit is contained in:
Jakob K
2021-06-15 21:48:59 +02:00
parent d95cf30181
commit 979353ac85
3 changed files with 35 additions and 0 deletions

View File

@@ -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

View File

@@ -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"
}
}
```

View File

@@ -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