build.gradle 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. jar{
  2. enabled false
  3. }
  4. bootJar {
  5. enabled true
  6. }
  7. configurations {
  8. compile.exclude module: "lettuce"
  9. }
  10. dependencies {
  11. //引入smartcity-common模块
  12. implementation project(':smartcity-common')
  13. //implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
  14. implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
  15. implementation 'org.springframework.boot:spring-boot-starter-web'
  16. implementation 'org.springframework.boot:spring-boot-starter-jdbc'
  17. implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2'
  18. implementation 'org.springframework.cloud:spring-cloud-starter-oauth2'
  19. implementation 'org.springframework.cloud:spring-cloud-starter-security'
  20. implementation ('org.springframework.boot:spring-boot-starter-data-redis')
  21. implementation('org.springframework.kafka:spring-kafka')
  22. implementation 'org.springframework.cloud:spring-cloud-starter-stream-kafka'
  23. implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery'
  24. implementation 'com.alibaba.cloud:spring-cloud-starter-dubbo'
  25. /* {
  26. exclude group: 'io.lettuce', module: 'lettuce-core'
  27. }*/
  28. //compile("redis.clients:jedis")
  29. compile("org.apache.commons:commons-pool2")
  30. implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
  31. compile('mysql:mysql-connector-java:5.1.47')
  32. compile('org.apache.commons:commons-lang3:3.4')
  33. compile('commons-collections:commons-collections:3.2.2')
  34. compile('io.jsonwebtoken:jjwt:0.9.0')
  35. //json工具
  36. compile('com.alibaba:fastjson:1.2.41')
  37. //数据源连接池
  38. //compile('com.alibaba:druid:1.1.6')
  39. compile('com.alibaba:druid-spring-boot-starter:1.1.9')
  40. //分页插件
  41. compile('com.github.pagehelper:pagehelper-spring-boot-starter:1.2.10')
  42. //阿里云
  43. compile('com.aliyun:aliyun-java-sdk-core:4.1.0')
  44. testImplementation('org.springframework.boot:spring-boot-starter-test') {
  45. exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
  46. }
  47. }
  48. test {
  49. useJUnitPlatform()
  50. }
  51. task deploySit(dependsOn:bootJar){
  52. def active = 'sit'
  53. def applicationName = 'smartcity-user'
  54. def targetDir = '/opt/sit/smartcity-user'
  55. doLast {
  56. println "deploy ${applicationName} ${active}..."
  57. ssh.settings {
  58. knownHosts = allowAnyHosts
  59. }
  60. ssh.run {
  61. session(remotes.sitServer){
  62. put from: "build/libs/${jar.archiveName}", into: "${targetDir}"
  63. execute """
  64. source /root/.bash_profile;
  65. kill `ps aux | grep -i ${applicationName} | grep -v grep | awk '{print \$2}'`;
  66. nohup java -jar ${targetDir}/${jar.archiveName} --spring.profiles.active=${active} >/dev/null &
  67. """
  68. }
  69. }
  70. }
  71. }
  72. task deployUat(dependsOn:bootJar){
  73. def active = 'uat'
  74. def applicationName = 'smartcity-user'
  75. def targetDir = '/opt/uat/smartcity-user'
  76. doLast {
  77. println "deploy ${applicationName} ${active}..."
  78. ssh.settings {
  79. knownHosts = allowAnyHosts
  80. }
  81. ssh.run {
  82. session(remotes.uatServer155){
  83. put from: "build/libs/${jar.archiveName}", into: "${targetDir}"
  84. execute """
  85. source /root/.bash_profile;
  86. kill `ps aux | grep -i ${applicationName} | grep -v grep | awk '{print \$2}'`;
  87. nohup java -jar ${targetDir}/${jar.archiveName} --spring.profiles.active=${active} >/dev/null &
  88. """
  89. }
  90. }
  91. }
  92. }
  93. def releaseTime() {
  94. return new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00"))
  95. }
  96. archivesBaseName = "smartcity-user-${releaseTime()}"