build.gradle.kts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
  2. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  3. plugins {
  4. kotlin("jvm") version "1.6.10"
  5. application
  6. id("nu.studer.rocker") version "3.0.4"
  7. id("com.github.johnrengelman.shadow") version "7.1.2"
  8. }
  9. group = "io.vertx"
  10. version = "4.1.5"
  11. repositories {
  12. mavenCentral()
  13. }
  14. dependencies {
  15. implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
  16. implementation(platform("io.vertx:vertx-stack-depchain:$version"))
  17. implementation("io.vertx:vertx-core")
  18. implementation("com.fasterxml.jackson.module:jackson-module-blackbird:2.12.4")
  19. implementation("io.vertx:vertx-web")
  20. implementation("io.vertx:vertx-pg-client")
  21. implementation("io.vertx:vertx-web-templ-rocker")
  22. implementation("io.netty", "netty-transport-native-epoll", classifier = "linux-x86_64")
  23. implementation("io.vertx:vertx-lang-kotlin")
  24. implementation("io.vertx:vertx-lang-kotlin-coroutines")
  25. }
  26. rocker {
  27. configurations {
  28. create("main") {
  29. templateDir.set(file("src/main/resources"))
  30. optimize.set(true)
  31. javaVersion.set("1.8")
  32. }
  33. }
  34. }
  35. tasks.withType<KotlinCompile> {
  36. kotlinOptions.jvmTarget = "11"
  37. }
  38. // content below copied from the project generated by the app generator
  39. val mainVerticleName = "io.vertx.benchmark.App"
  40. val launcherClassName = "io.vertx.core.Launcher"
  41. application {
  42. mainClass.set(launcherClassName)
  43. }
  44. tasks.withType<ShadowJar> {
  45. archiveClassifier.set("fat")
  46. manifest {
  47. attributes(mapOf("Main-Verticle" to mainVerticleName))
  48. }
  49. mergeServiceFiles()
  50. }
  51. val watchForChange = "src/**/*"
  52. val doOnChange = "${projectDir}/gradlew classes"
  53. tasks.withType<JavaExec> {
  54. args = listOf(
  55. "run",
  56. mainVerticleName,
  57. "--redeploy=$watchForChange",
  58. "--launcher-class=$launcherClassName",
  59. "--on-redeploy=$doOnChange"
  60. )
  61. }