build.gradle.kts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. import org.springframework.boot.gradle.tasks.bundling.BootJar
  2. group = "cc-lotus.gaf3"
  3. version = rootProject.version
  4. plugins {
  5. id("java")
  6. id("io.spring.dependency-management")
  7. id("org.springframework.boot") apply false
  8. kotlin("jvm")
  9. kotlin("plugin.spring")
  10. kotlin("plugin.jpa") apply false
  11. }
  12. java {
  13. disableAutoTargetJvm()
  14. // withSourcesJar()
  15. // withJavadocJar()
  16. }
  17. repositories {
  18. maven {
  19. name = "aliyun"
  20. url = uri("http://maven.aliyun.com/nexus/content/groups/public/")
  21. }
  22. // mavenCentral()
  23. }
  24. allprojects {
  25. apply(plugin = "java")
  26. tasks {
  27. processResources {
  28. // expand("db.user" to dbUser)
  29. // expand 在处理奇数个中文的时候会出现乱码情况
  30. // 所以这里只处理application.yml,忽略其他资源文件,避免处理后产生乱码
  31. filesMatching("application.yml") {
  32. expand(project.properties)
  33. }
  34. // expand(project.properties)
  35. }
  36. }
  37. }
  38. subprojects {
  39. group = "cc-lotus.gaf3"
  40. version = rootProject.version
  41. apply(plugin = "org.springframework.boot")
  42. apply(plugin = "io.spring.dependency-management")
  43. apply(plugin = "org.jetbrains.kotlin.jvm")
  44. apply(plugin = "org.jetbrains.kotlin.plugin.spring")
  45. apply(plugin = "org.jetbrains.kotlin.plugin.jpa")
  46. dependencies {
  47. api(platform(project(":platform")))
  48. api(project(path = ":shared:cloud"))
  49. api(project(path = ":shared:util"))
  50. api(kotlin("reflect"))
  51. api(kotlin("stdlib-jdk8"))
  52. implementation("org.springframework.boot:spring-boot-starter-webflux")
  53. implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
  54. implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
  55. implementation("org.springframework.boot:spring-boot-configuration-processor")
  56. implementation("com.alibaba:fastjson")
  57. implementation("commons-io:commons-io")
  58. implementation("io.jsonwebtoken:jjwt-api")
  59. implementation("io.jsonwebtoken:jjwt-impl")
  60. implementation("io.jsonwebtoken:jjwt-jackson")
  61. implementation("javax.validation:validation-api")
  62. runtimeOnly("org.hibernate.validator:hibernate-validator")
  63. runtimeOnly(fileTree("$rootDir/libs") { include("*.jar") })
  64. }
  65. dependencyManagement {
  66. imports {
  67. mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
  68. }
  69. }
  70. // tasks.register<Jar>(name = "libJar") {
  71. // archiveBaseName.set("gaf3-${project.name}-lib")
  72. // from(sourceSets["main"].output)
  73. // include("gaf3/**")
  74. // exclude {
  75. // it.name.endsWith("Application.class")
  76. // }
  77. // exclude {
  78. // it.name.endsWith("ApplicationKt.class")
  79. // }
  80. // exclude {
  81. // it.name.endsWith("Application${'$'}Companion.class")
  82. // }
  83. // }
  84. // tasks.build { dependsOn(tasks.named("libJar")) }
  85. configurations {
  86. create("lib")
  87. }
  88. artifacts {
  89. add("lib", tasks.jar)
  90. }
  91. tasks.withType<Jar> {
  92. archiveBaseName.set("gaf3-${project.name}")
  93. }
  94. tasks.named<BootJar>(name = "bootJar") {
  95. archiveClassifier.set("application")
  96. }
  97. tasks.jar {
  98. enabled = true
  99. // archiveAppendix.set("lib")
  100. exclude {
  101. it.name.endsWith("Application.class")
  102. }
  103. exclude {
  104. it.name.endsWith("ApplicationKt.class")
  105. }
  106. exclude {
  107. it.name.endsWith("Application${'$'}Companion.class")
  108. }
  109. }
  110. }
  111. configure(subprojects.filter { it.name != "service-api" && it.name != "service-verify" && it.name != "service-token" }) {
  112. dependencies {
  113. implementation("org.springframework.boot:spring-boot-starter-data-jpa")
  114. implementation("org.springframework.boot:spring-boot-starter-webflux")
  115. implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
  116. runtimeOnly("mysql:mysql-connector-java")
  117. testImplementation("org.springframework.boot:spring-boot-starter-test")
  118. // "testImplementation"("io.projectreactor:reactor-test")
  119. // testCompile("junit", "junit", "4.12")
  120. }
  121. }
  122. project("service-all") {
  123. dependencies {
  124. implementation(project(path = ":services:service-auth", configuration = "lib"))
  125. implementation(project(path = ":services:service-bind", configuration = "lib"))
  126. implementation(project(path = ":services:service-role", configuration = "lib"))
  127. implementation(project(path = ":services:service-code", configuration = "lib"))
  128. implementation(project(path = ":services:service-user", configuration = "lib"))
  129. implementation(project(path = ":services:service-log", configuration = "lib"))
  130. implementation(project(path = ":services:service-dept", configuration = "lib"))
  131. implementation(project(path = ":services:service-menu", configuration = "lib"))
  132. implementation(project(path = ":services:service-bff", configuration = "lib"))
  133. }
  134. }
  135. project("service-bff") {
  136. dependencies {
  137. api(project(path = ":shared:cloud"))
  138. api(project(path = ":shared:util"))
  139. api(project(path = ":services:service-bind", configuration = "lib"))
  140. api(project(path = ":services:service-user", configuration = "lib"))
  141. api(project(path = ":services:service-dept", configuration = "lib"))
  142. api(project(path = ":services:service-role", configuration = "lib"))
  143. }
  144. }
  145. project("service-auth") {
  146. dependencies {
  147. implementation(project(path = ":services:service-bff", configuration = "lib"))
  148. api(project(path = ":services:service-user", configuration = "lib"))
  149. api(project(path = ":services:service-role", configuration = "lib"))
  150. api(project(path = ":services:service-bind", configuration = "lib"))
  151. }
  152. }
  153. project(":services") {
  154. tasks.jar {
  155. archiveBaseName.set("gaf3-core-${project.name}")
  156. subprojects {
  157. from(tasks.withType<JavaCompile>())
  158. from(tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>())
  159. include("gaf3/**")
  160. exclude {
  161. it.name.endsWith("Application.class")
  162. }
  163. exclude {
  164. it.name.endsWith("ApplicationKt.class")
  165. }
  166. exclude {
  167. it.name.endsWith("Application${'$'}Companion.class")
  168. }
  169. }
  170. }
  171. publishing {
  172. publications {
  173. create<MavenPublication>("maven") {
  174. artifactId = "gaf-core-${project.name}"
  175. from(components["java"])
  176. }
  177. }
  178. }
  179. }