build.gradle.kts 2.0 KB

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