build.gradle 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. jar{
  2. enabled false
  3. }
  4. bootJar {
  5. enabled true
  6. }
  7. dependencies {
  8. implementation project(':smartcity-common')
  9. //implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
  10. implementation 'org.springframework.boot:spring-boot-starter-web'
  11. implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
  12. implementation 'org.springframework.boot:spring-boot-starter-actuator'
  13. implementation 'org.springframework.cloud:spring-cloud-starter-oauth2'
  14. implementation 'org.springframework.cloud:spring-cloud-starter-security'
  15. implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
  16. implementation 'org.springframework.cloud:spring-cloud-starter-stream-kafka'
  17. implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery'
  18. implementation ('com.alibaba.cloud:spring-cloud-starter-dubbo')
  19. //poi
  20. compile 'org.apache.poi:poi:3.17'
  21. compile 'org.apache.poi:poi-ooxml:3.17'
  22. compile 'org.apache.poi:poi-ooxml-schemas:3.17'
  23. //jxls
  24. //compile 'org.jxls.jxls:2.4.6'
  25. compile 'org.jxls:jxls-poi:1.0.16'
  26. testImplementation('org.springframework.boot:spring-boot-starter-test') {
  27. exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
  28. }
  29. compile('com.alibaba:fastjson:1.2.41')
  30. }
  31. test {
  32. useJUnitPlatform()
  33. }
  34. task deploySit(dependsOn:bootJar){
  35. def active = 'sit'
  36. def applicationName = 'smartcity-device'
  37. def targetDir = '/opt/sit/smartcity-device'
  38. doLast {
  39. println "deploy ${applicationName} ${active}..."
  40. ssh.settings {
  41. knownHosts = allowAnyHosts
  42. }
  43. ssh.run {
  44. session(remotes.sitServer){
  45. put from: "build/libs/${jar.archiveName}", into: "${targetDir}"
  46. execute """
  47. source /root/.bash_profile;
  48. kill `ps aux | grep -i ${applicationName} | grep -v grep | awk '{print \$2}'`;
  49. nohup java -jar ${targetDir}/${jar.archiveName} --spring.profiles.active=${active} >/dev/null &
  50. """
  51. }
  52. }
  53. }
  54. }
  55. task deployUat(dependsOn:bootJar){
  56. def active = 'uat'
  57. def applicationName = 'smartcity-device'
  58. def targetDir = '/opt/uat/smartcity-device'
  59. doLast {
  60. println "deploy ${applicationName} ${active}..."
  61. ssh.settings {
  62. knownHosts = allowAnyHosts
  63. }
  64. ssh.run {
  65. session(remotes.uatServer156){
  66. put from: "build/libs/${jar.archiveName}", into: "${targetDir}"
  67. execute """
  68. source /root/.bash_profile;
  69. kill `ps aux | grep -i ${applicationName} | grep -v grep | awk '{print \$2}'`;
  70. nohup java -jar ${targetDir}/${jar.archiveName} --spring.profiles.active=${active} >/dev/null &
  71. """
  72. }
  73. }
  74. }
  75. }
  76. def releaseTime() {
  77. return new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00"))
  78. }
  79. archivesBaseName = "smartcity-device-${releaseTime()}"