build.gradle 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. /*
  2. * ********************************************************************************************************************
  3. *
  4. * :*$@@%$*: ;: ;; ;;
  5. * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@
  6. * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$
  7. * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$=
  8. * =@* %! @ $= % %@= =%@! %=
  9. * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =%
  10. * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%*
  11. * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$
  12. * $@* ;@@@%=!: *@*
  13. * =@$ ;;;!=%@@@@=! =@!
  14. * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司
  15. * ;%@@$=$@@%* *@@@$=%@@%;
  16. * ::;:: ::;:: All rights reserved.
  17. *
  18. * ********************************************************************************************************************
  19. */
  20. group rootProject.group
  21. version rootProject.version
  22. apply plugin: "kotlin"
  23. apply plugin: "org.jetbrains.dokka"
  24. apply plugin: "war"
  25. apply plugin: 'maven'
  26. apply plugin: 'org.springframework.boot'
  27. apply plugin: 'io.spring.dependency-management'
  28. apply plugin: "java"
  29. apply plugin: 'org.hidetake.ssh'
  30. sourceCompatibility = 1.8
  31. targetCompatibility = 1.8
  32. compileKotlin {
  33. kotlinOptions.jvmTarget = 1.8
  34. }
  35. compileTestKotlin {
  36. kotlinOptions.jvmTarget = 1.8
  37. }
  38. dependencies {
  39. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  40. // kotlin 依赖
  41. compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: KOTLIN_VERSION
  42. compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: KOTLIN_VERSION
  43. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  44. // 页面
  45. compile group: "org.springframework.boot", name: "spring-boot-starter-freemarker", version: SPRING_BOOT_VERSION
  46. // spring boot 依赖
  47. compile(group: "org.springframework.boot", name: "spring-boot-starter-web", version: SPRING_BOOT_VERSION){
  48. exclude group: 'org.apache.logging.log4j',module:'log4j-api'
  49. exclude group: 'org.springframework.boot',module:'spring-boot-starter-tomcat'
  50. exclude group: 'org.apache.tomcat.embed',module:'tomcat-embed-core'
  51. exclude group: 'org.apache.tomcat.embed',module:'tomcat-embed-el'
  52. exclude group: 'org.apache.tomcat.embed',module:'tomcat-embed-websocket'
  53. }
  54. compile group: "org.springframework.boot", name: "spring-boot-starter-tomcat", version: '2.6.10'
  55. compile(group: "org.apache.tomcat.embed", name: "tomcat-embed-core", version: '9.0.65'){exclude group:'org.apache.tomcat',module:'tomcat-annotations-api'}
  56. compile group: "org.apache.tomcat.embed", name: "tomcat-embed-el", version: '9.0.65'
  57. compile(group: "org.apache.tomcat.embed", name: "tomcat-embed-websocket", version: '9.0.65'){exclude group:'org.apache.tomcat',module:'tomcat-annotations-api'}
  58. compile group: "org.apache.logging.log4j", name: "log4j-api", version: LOG4J_VERSION
  59. compile group: "org.springframework.boot", name: "spring-boot-configuration-processor", version: SPRING_BOOT_VERSION
  60. compile group: "org.springframework.boot", name: "spring-boot-starter-actuator", version: SPRING_BOOT_VERSION
  61. compile group: "org.springframework.boot", name: "spring-boot-starter-logging", version: SPRING_BOOT_VERSION
  62. //消息
  63. //compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION
  64. providedCompile group: "org.springframework.boot", name:"spring-boot-starter-tomcat", version: SPRING_BOOT_VERSION
  65. // spring boot 缓存
  66. compile group:"org.springframework.boot", name:"spring-boot-starter-cache", version: SPRING_BOOT_VERSION
  67. // // PostgreSQL
  68. // //https://mvnrepository.com/artifact/org.postgresql/postgresql
  69. // compile group: 'org.postgresql', name: 'postgresql', version: POSTGRESQL_VERSION
  70. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  71. // RESTful API 文档生成工具
  72. // https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
  73. compile group: "io.springfox", name: "springfox-swagger-ui", version: SWAGGER_VERSION
  74. compile group: "io.springfox", name: "springfox-swagger2", version: SWAGGER_VERSION
  75. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  76. // Sybotan依赖
  77. // compile group: "com.sybotan", name: "sybotan-kotlin-base", version: SYBOTAN_KOTLIN_VERSION
  78. // compile group: "com.sybotan", name: "sybotan-kotlin-database", version: SYBOTAN_KOTLIN_VERSION
  79. // compile group: "com.sybotan", name: "sybotan-kotlin-mybatis", version: SYBOTAN_KOTLIN_VERSION
  80. // compile group: "com.sybotan", name: "sybotan-kotlin-postgresql", version: SYBOTAN_KOTLIN_VERSION
  81. // compile group: "com.sybotan", name: "sybotan-service-base", version: SYBOTAN_SERVICE_VERSION
  82. // compile group: "com.sybotan", name: "sybotan-service-mybatis", version: SYBOTAN_SERVICE_VERSION
  83. // 带隐性数据库接口
  84. compile group: "com.alibaba", name: "fastjson", version: FAST_JSON_VERSION
  85. compile(group: "cn.sagacloud", name: "saga-kotlin-base", version: SYBOTAN_KOTLIN_VERSION) {exclude group: 'com.alibaba',module:'fastjson'}
  86. compile group: "cn.sagacloud", name: "saga-kotlin-database", version: SYBOTAN_KOTLIN_VERSION
  87. compile(group: "cn.sagacloud", name: "saga-kotlin-mybatis", version: SYBOTAN_KOTLIN_VERSION) {exclude group: 'org.mybatis',module:'mybatis'}
  88. compile group: "org.mybatis", name: "mybatis", version: MYBATIS_CORE_VERSION
  89. compile group: "cn.sagacloud", name: "saga-kotlin-mysql", version: SYBOTAN_KOTLIN_VERSION
  90. compile group: "cn.sagacloud", name: "saga-service-base", version: SYBOTAN_SERVICE_VERSION
  91. compile group: "cn.sagacloud", name: "saga-service-mybatis", version: SYBOTAN_SERVICE_VERSION
  92. compile group: "cn.sagacloud", name: "saga-service-mysql", version: SYBOTAN_SERVICE_VERSION
  93. // 生成uuid
  94. // https://mvnrepository.com/artifact/com.fasterxml.uuid/java-uuid-generator
  95. compile group: 'com.fasterxml.uuid', name: 'java-uuid-generator', version: '3.2.0'
  96. // https://mvnrepository.com/artifact/com.google.guava/guava
  97. // compile group: 'com.google.guava', name: 'guava', version: '28.1-jre'
  98. // 上传文件
  99. // https://mvnrepository.com/artifact/commons-io/commons-io
  100. compile 'commons-io:commons-io:1.4'
  101. // https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload
  102. compile 'commons-fileupload:commons-fileupload:1.3.1'
  103. // https://mvnrepository.com/artifact/com.alibaba/fastjson
  104. // compile group: 'com.alibaba', name: 'fastjson', version: '1.2.56'
  105. // // anko依赖
  106. // // https://mvnrepository.com/artifact/org.jetbrains.anko/anko-commons
  107. // implementation group: 'org.jetbrains.anko', name: 'anko-commons', version: '0.10.8'
  108. //poi
  109. // https://mvnrepository.com/artifact/org.apache.poi/poi
  110. compile group: 'org.apache.poi', name: 'poi', version: '4.1.1'
  111. // https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml
  112. compile group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.1'
  113. // // https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas
  114. // compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '4.1.1'
  115. // https://mvnrepository.com/artifact/org.apache.poi/ooxml-schemas
  116. compile group: 'org.apache.poi', name: 'ooxml-schemas', version: '1.4'
  117. // https://mvnrepository.com/artifact/com.aliyun.oss/aliyun-sdk-oss
  118. compile group: 'com.aliyun.oss', name: 'aliyun-sdk-oss', version: '3.5.0'
  119. // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
  120. compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.2.2'
  121. // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
  122. compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
  123. // 处理拼音
  124. // https://mvnrepository.com/artifact/com.belerweb/pinyin4j
  125. compile group: 'com.belerweb', name: 'pinyin4j', version: '2.5.1'
  126. // http://47.93.132.139:8081/nexus/content/repositories/persagy/
  127. compile group: 'org.geotools', name: 'gt-main', version: '25.2'
  128. compile group: 'org.apache.skywalking', name: 'apm-toolkit-logback-1.x', version: APM_SKYWALKING_VERSION
  129. // 数据中心依赖
  130. compile project(":old-data-core")
  131. }
  132. dependencyManagement {
  133. imports {
  134. mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_DEPENDENCIES}"
  135. mavenBom "org.geotools:gt-main:25.2"
  136. }
  137. }
  138. // 下面是配置文件选择
  139. /*******************************************************/
  140. sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev']
  141. //ext.needTest = 'true'
  142. task doWar{
  143. dependsOn build
  144. doLast {
  145. file('build\\libs\\revit-algorithm-2.0.0.war').renameTo('build\\libs\\revit-algorithm.war')
  146. }
  147. }
  148. task doJar{
  149. dependsOn bootJar
  150. doFirst {
  151. file('build\\libs\\revit-algorithm-2.0.0.jar').renameTo('d:/000/revit-algorithm.jar')
  152. }
  153. }
  154. // 打产品包
  155. task buildProdWar {
  156. doFirst {
  157. sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"]
  158. test.onlyIf {
  159. project.hasProperty("needTest")
  160. }
  161. }
  162. finalizedBy(doWar)
  163. }
  164. // 打测试环境包
  165. task buildTestWar {
  166. doFirst {
  167. sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-test']
  168. test.onlyIf {
  169. project.hasProperty("needTest")
  170. }
  171. }
  172. finalizedBy(doWar)
  173. }
  174. // 打开发环境包
  175. task buildDevWar {
  176. doFirst {
  177. sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev']
  178. test.onlyIf {
  179. project.hasProperty("needTest")
  180. }
  181. }
  182. finalizedBy(doWar)
  183. }
  184. // 打开发环境包
  185. task buildDevJar {
  186. doFirst {
  187. sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev']
  188. test.onlyIf {
  189. project.hasProperty("needTest")
  190. }
  191. }
  192. finalizedBy(doJar)
  193. }
  194. // 打生产环境包
  195. task buildProdJar {
  196. doFirst {
  197. sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"]
  198. test.onlyIf {
  199. project.hasProperty("needTest")
  200. }
  201. }
  202. finalizedBy(doJar)
  203. }
  204. remotes {
  205. testServer {
  206. role 'testNode'
  207. host = '192.168.20.234'
  208. user = 'saga'
  209. // identity = file("C:\\Users\\jxing\\.ssh\\id_rsa")
  210. identity = file("${System.properties['user.home']}\\.ssh\\id_rsa")
  211. }
  212. }
  213. task depolyTestServer {
  214. doLast {
  215. ssh.run {
  216. session(remotes.testServer) {
  217. // Execute a command
  218. def result = execute 'rm /opt/tomcat9/webapps/revit-algorithm.war', ignoreError: true
  219. println result
  220. while(true) {
  221. result = execute 'ls /opt/tomcat9/webapps'
  222. println result
  223. if(result.indexOf('revit-algorithm') < 0){
  224. break
  225. }
  226. sleep(1000)
  227. }
  228. put from: 'build\\libs\\revit-algorithm-2.0.0.war', into: '.'
  229. result = execute 'mv revit-algorithm-2.0.0.war /opt/tomcat9/webapps/revit-algorithm.war'
  230. // Also Groovy methods or properties are available in a session closure
  231. println result
  232. }
  233. }
  234. }
  235. }