build.gradle 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. jar{
  2. enabled false
  3. }
  4. bootJar {
  5. enabled true
  6. }
  7. dependencies {
  8. //引入smartcity-common模块
  9. implementation project(':smartcity-common')
  10. implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
  11. implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
  12. implementation 'org.springframework.boot:spring-boot-starter-web'
  13. implementation 'org.springframework.cloud:spring-cloud-starter-oauth2'
  14. implementation 'org.springframework.cloud:spring-cloud-starter-security'
  15. compile('mysql:mysql-connector-java')
  16. //数据源连接池
  17. //compile('com.alibaba:druid:1.1.6')
  18. compile('com.alibaba:druid-spring-boot-starter:1.1.9')
  19. //分页插件
  20. compile('com.github.pagehelper:pagehelper-spring-boot-starter:1.2.10')
  21. testImplementation('org.springframework.boot:spring-boot-starter-test') {
  22. exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
  23. }
  24. }
  25. test {
  26. useJUnitPlatform()
  27. }
  28. /*
  29. remotes {
  30. //开发环境服务器
  31. devServer {
  32. host = '114.135.61.188'
  33. port = 30154
  34. user = 'root'
  35. password = '1qaz2wsx!'
  36. }
  37. //测试环境服务器
  38. sitServer {
  39. host = '114.135.61.188'
  40. port = 30154
  41. user = 'root'
  42. password = '1qaz2wsx!'
  43. }
  44. }
  45. */
  46. task deploy(dependsOn:bootJar){
  47. doLast {
  48. println 'deploy...'
  49. ssh.run {
  50. session(remotes.sitServer){
  51. put from: 'build/libs/smartcity-web.jar', into: '/opt/sit/smartcity-web'
  52. def result = execute '/opt/sit/stop-port.sh 8324'
  53. println result
  54. execute 'nohup java -jar /opt/sit/smartcity-web/smartcity-web.jar --spring.profiles.active=sit >/dev/null &'
  55. }
  56. }
  57. }
  58. }