build.gradle.kts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. val patchVersion: String by project
  2. group = "jit.xms"
  3. version = "${rootProject.version}.$patchVersion"
  4. plugins {
  5. id("java")
  6. id("io.spring.dependency-management")
  7. id("org.springframework.boot")
  8. kotlin("jvm")
  9. kotlin("plugin.spring")
  10. }
  11. dependencies {
  12. implementation(project(path = ":services:multi-factor", configuration = "lib"))
  13. implementation(project(path = ":services:cert-down", configuration = "lib"))
  14. implementation(project(path = ":shared:multi-factor-api"))
  15. implementation(project(path = ":shared:util"))
  16. implementation(kotlin("reflect"))
  17. implementation(kotlin("stdlib-jdk8"))
  18. // implementation(fileTree("$rootDir/libs") { include("xms-core-*.jar") })
  19. // implementation(fileTree("$rootDir/libs") { include("gaf-core-*.jar") })
  20. implementation("org.apache.commons:commons-dbcp2:2.7.0")
  21. implementation("cc-lotus.gaf3:gaf-core-shared:${property("gafVersion")}")
  22. implementation("cc-lotus.gaf3:gaf-core-services:${property("gafVersion")}")
  23. implementation("cc-lotus.gaf3:gaf-core-gateway:${property("gafVersion")}")
  24. implementation("jit.xms:xms-core-shared:${property("xmsVersion")}")
  25. implementation("jit.xms:xms-core-services:${property("xmsVersion")}")
  26. implementation("org.springframework.boot:spring-boot-starter-data-jpa")
  27. implementation("org.springframework.boot:spring-boot-starter-webflux")
  28. implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
  29. implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
  30. implementation("org.springframework.cloud:spring-cloud-starter-gateway")
  31. implementation("io.jsonwebtoken:jjwt-api:${property("jjwtVersion")}")
  32. implementation("io.jsonwebtoken:jjwt-impl:${property("jjwtVersion")}")
  33. implementation("io.jsonwebtoken:jjwt-jackson:${property("jjwtVersion")}")
  34. annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
  35. runtimeOnly("mysql:mysql-connector-java:5.1.34")
  36. runtimeOnly("net.java.dev.jna:jna:5.5.0")
  37. runtimeOnly(fileTree("$rootDir/libs") { include("*.jar") })
  38. runtimeOnly(fileTree("$rootDir/spi") { include("*.jar") })
  39. implementation("javax.validation:validation-api")
  40. runtimeOnly("org.hibernate.validator:hibernate-validator")
  41. dependencyManagement {
  42. imports {
  43. mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
  44. }
  45. }
  46. }
  47. tasks {
  48. processResources {
  49. filesMatching("application-db.yml") {
  50. // expand("db.user" to dbUser)
  51. expand(project.properties)
  52. }
  53. }
  54. }
  55. tasks.register<Sync>("script") {
  56. from("script")
  57. into("$buildDir/script")
  58. expand("name" to project.name, "version" to version)
  59. }
  60. tasks.register<Sync>("ext-libs") {
  61. from(configurations["runtimeClasspath"])
  62. into("$buildDir/dist/ext")
  63. }
  64. tasks.register<Copy>("dist") {
  65. dependsOn(tasks.named("bootJar"), tasks.named("ext-libs"), tasks.named("script"))
  66. into("$rootDir/dist/${project.name}")
  67. from(tasks["bootJar"].outputs)
  68. from("$buildDir/script")
  69. // from("$buildDir/resources/main") {
  70. // include("*.yml")
  71. // into("config")
  72. // }
  73. val splitJars: String by project
  74. if ("true".equals(splitJars, true)) {
  75. from("$buildDir/dist/ext") {
  76. include("*.jar")
  77. into("../ext")
  78. }
  79. }
  80. }
  81. tasks.getByName<org.springframework.boot.gradle.tasks.bundling.BootJar>("bootJar") {
  82. // 排除所有jar包
  83. val splitJars: String by project
  84. if ("true".equals(splitJars, true)) {
  85. exclude("*.jar")
  86. }
  87. // 依赖复制任务
  88. // dependsOn(tasks.named("ext-libs"), tasks.named("script"))
  89. // 指定依赖包的路径
  90. manifest {
  91. val classPath = configurations["runtimeClasspath"].files
  92. .joinToString(" ") { "../ext/${it.name}" }
  93. attributes("Class-Path" to classPath)
  94. }
  95. }