build.gradle 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. group 'cn.sagacloud.server'
  2. version '2.0.0'
  3. apply plugin: "kotlin"
  4. apply plugin: 'java'
  5. apply plugin: "org.jetbrains.dokka"
  6. apply plugin: "war"
  7. apply plugin: 'org.springframework.boot'
  8. apply plugin: 'io.spring.dependency-management'
  9. apply plugin: 'maven'
  10. //apply plugin: 'com.google.protobuf'
  11. //apply plugin: 'application'
  12. sourceCompatibility = 1.8
  13. compileKotlin {
  14. kotlinOptions.jvmTarget = JVM_TARGET
  15. }
  16. compileTestKotlin {
  17. kotlinOptions.jvmTarget = JVM_TARGET
  18. }
  19. //protobuf {
  20. // generatedFilesBaseDir = "src"
  21. // protoc {
  22. // artifact = "com.google.protobuf:protoc:3.7.0"
  23. // }
  24. //
  25. //// plugins {
  26. //// grpc {
  27. //// artifact = 'io.grpc:protoc-gen-grpc-java:1.19.0'
  28. //// }
  29. //// }
  30. //// generateProtoTasks {
  31. //// all()*.plugins {
  32. //// grpc {}
  33. //// }
  34. //// }
  35. //}
  36. tasks.withType(JavaCompile) {
  37. options.encoding = "UTF-8"
  38. }
  39. dependencies {
  40. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
  41. testCompile group: 'junit', name: 'junit', version: '4.12'
  42. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  43. // // kotlin 依赖
  44. compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: KOTLIN_VERSION
  45. compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: KOTLIN_VERSION
  46. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  47. // 页面
  48. compile group: "org.springframework.boot", name: "spring-boot-starter-freemarker", version: SPRING_BOOT_VERSION
  49. // spring boot 依赖
  50. compile group: "org.springframework.boot", name: "spring-boot-starter-web", version: SPRING_BOOT_VERSION
  51. compile group: "org.springframework.boot", name: "spring-boot-configuration-processor", version: SPRING_BOOT_VERSION
  52. compile group: "org.springframework.boot", name: "spring-boot-starter-actuator", version: SPRING_BOOT_VERSION
  53. compile group: "org.springframework.boot", name: "spring-boot-starter-logging", version: SPRING_BOOT_VERSION
  54. //消息
  55. // compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION
  56. providedCompile group: "org.springframework.boot", name:"spring-boot-starter-tomcat", version: SPRING_BOOT_VERSION
  57. // spring boot 缓存
  58. compile group:"org.springframework.boot", name:"spring-boot-starter-cache", version: SPRING_BOOT_VERSION
  59. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  60. // spring cloud 依赖
  61. // compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka', version: SPRING_CLOUD_VERSION
  62. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  63. // MySQL
  64. // https://mvnrepository.com/artifact/mysql/mysql-connector-java
  65. // compile group: 'mysql', name: 'mysql-connector-java', version: MYSQL_VERSION
  66. // // PostgreSQL
  67. // //https://mvnrepository.com/artifact/org.postgresql/postgresql
  68. // compile group: 'org.postgresql', name: 'postgresql', version: POSTGRESQL_VERSION
  69. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  70. // RESTful API 文档生成工具
  71. // https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
  72. compile group: "io.springfox", name: "springfox-swagger-ui", version: SWAGGER_VERSION
  73. compile group: "io.springfox", name: "springfox-swagger2", version: SWAGGER_VERSION
  74. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  75. // Sybotan依赖
  76. compile group: "cn.sagacloud", name: "saga-kotlin-base", version: SYBOTAN_KOTLIN_VERSION
  77. compile group: "cn.sagacloud", name: "saga-kotlin-database", version: SYBOTAN_KOTLIN_VERSION
  78. compile group: "cn.sagacloud", name: "saga-kotlin-mybatis", version: SYBOTAN_KOTLIN_VERSION
  79. compile group: "cn.sagacloud", name: "saga-kotlin-mysql", version: SYBOTAN_KOTLIN_VERSION
  80. compile group: "cn.sagacloud", name: "saga-service-base", version: SYBOTAN_SERVICE_VERSION
  81. compile group: "cn.sagacloud", name: "saga-service-mybatis", version: SYBOTAN_SERVICE_VERSION
  82. compile group: "cn.sagacloud", name: "saga-service-mysql", version: SYBOTAN_SERVICE_VERSION
  83. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  84. // 数据中心依赖
  85. compile project(":old-data-core")
  86. // 网络操作依赖
  87. // https://mvnrepository.com/artifact/io.netty/netty-all
  88. compile group: 'io.netty', name: 'netty-all', version: NETTY_VERSION
  89. // // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
  90. // compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.7.0'
  91. // https://mvnrepository.com/artifact/org.mybatis/mybatis
  92. compile group: 'org.mybatis', name: 'mybatis', version: '3.5.0'
  93. // https://mvnrepository.com/artifact/org.mybatis/mybatis-guice
  94. compile group: 'org.mybatis', name: 'mybatis-guice', version: '3.10'
  95. // https://mvnrepository.com/artifact/org.yaml/snakeyaml
  96. compile group: 'org.yaml', name: 'snakeyaml', version: '1.24'
  97. // https://mvnrepository.com/artifact/com.google.inject/guice
  98. compile group: 'com.google.inject', name: 'guice', version: '4.2.2'
  99. // https://mvnrepository.com/artifact/log4j/log4j
  100. compile group: 'log4j', name: 'log4j', version: '1.2.17'
  101. // https://mvnrepository.com/artifact/com.alibaba/fastjson
  102. compile group: 'com.alibaba', name: 'fastjson', version: '1.2.56'
  103. compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.25'
  104. // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
  105. compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.11.4'
  106. // 生成uuid
  107. // https://mvnrepository.com/artifact/com.fasterxml.uuid/java-uuid-generator
  108. compile group: 'com.fasterxml.uuid', name: 'java-uuid-generator', version: '3.2.0'
  109. }
  110. //dependencyManagement {
  111. // imports {
  112. // mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_DEPENDENCIES}"
  113. // }
  114. //}
  115. // 下面是配置文件选择
  116. /*******************************************************/
  117. sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev']
  118. //ext.needTest = 'true'
  119. // 打产品包
  120. task buildProdWar {
  121. doFirst {
  122. sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"]
  123. test.onlyIf {
  124. project.hasProperty("needTest")
  125. }
  126. }
  127. finalizedBy(build)
  128. }
  129. // 打开发环境包
  130. task buildDevWar {
  131. doFirst {
  132. sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev']
  133. test.onlyIf {
  134. project.hasProperty("needTest")
  135. }
  136. }
  137. finalizedBy(build)
  138. }
  139. task buildTestWar {
  140. doFirst {
  141. sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-test"]
  142. test.onlyIf {
  143. project.hasProperty("needTest")
  144. }
  145. }
  146. finalizedBy(build)
  147. }
  148. // 打产品包
  149. task buildProdJar {
  150. doFirst {
  151. sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"]
  152. test.onlyIf {
  153. project.hasProperty("needTest")
  154. }
  155. }
  156. finalizedBy(bootJar)
  157. }
  158. // 打开发环境包
  159. task buildDevJar {
  160. doFirst {
  161. sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev']
  162. test.onlyIf {
  163. project.hasProperty("needTest")
  164. }
  165. }
  166. finalizedBy(bootJar)
  167. }