jar{ enabled false } bootJar { enabled true } configurations { compile.exclude module: "lettuce" } dependencies { //引入smartcity-common模块 implementation project(':smartcity-common') //implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2' implementation 'org.springframework.cloud:spring-cloud-starter-oauth2' implementation 'org.springframework.cloud:spring-cloud-starter-security' implementation ('org.springframework.boot:spring-boot-starter-data-redis') implementation('org.springframework.kafka:spring-kafka') implementation 'org.springframework.cloud:spring-cloud-starter-stream-kafka' implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery' implementation 'com.alibaba.cloud:spring-cloud-starter-dubbo' /* { exclude group: 'io.lettuce', module: 'lettuce-core' }*/ //compile("redis.clients:jedis") compile("org.apache.commons:commons-pool2") implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' compile('mysql:mysql-connector-java:5.1.47') compile('org.apache.commons:commons-lang3:3.4') compile('commons-collections:commons-collections:3.2.2') compile('io.jsonwebtoken:jjwt:0.9.0') //json工具 compile('com.alibaba:fastjson:1.2.41') //数据源连接池 //compile('com.alibaba:druid:1.1.6') compile('com.alibaba:druid-spring-boot-starter:1.1.9') //分页插件 compile('com.github.pagehelper:pagehelper-spring-boot-starter:1.2.10') //阿里云 compile('com.aliyun:aliyun-java-sdk-core:4.1.0') testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } } test { useJUnitPlatform() } task deploySit(dependsOn:bootJar){ def active = 'sit' def applicationName = 'smartcity-user' def targetDir = '/opt/sit/smartcity-user' doLast { println "deploy ${applicationName} ${active}..." ssh.settings { knownHosts = allowAnyHosts } ssh.run { session(remotes.sitServer){ put from: "build/libs/${jar.archiveName}", into: "${targetDir}" execute """ source /root/.bash_profile; kill `ps aux | grep -i ${applicationName} | grep -v grep | awk '{print \$2}'`; nohup java -jar ${targetDir}/${jar.archiveName} --spring.profiles.active=${active} >/dev/null & """ } } } } task deployUat(dependsOn:bootJar){ def active = 'uat' def applicationName = 'smartcity-user' def targetDir = '/opt/uat/smartcity-user' doLast { println "deploy ${applicationName} ${active}..." ssh.settings { knownHosts = allowAnyHosts } ssh.run { session(remotes.uatServer155){ put from: "build/libs/${jar.archiveName}", into: "${targetDir}" execute """ source /root/.bash_profile; kill `ps aux | grep -i ${applicationName} | grep -v grep | awk '{print \$2}'`; nohup java -jar ${targetDir}/${jar.archiveName} --spring.profiles.active=${active} >/dev/null & """ } } } } def releaseTime() { return new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00")) } archivesBaseName = "smartcity-user-${releaseTime()}"