jar{ enabled false } bootJar { enabled true } dependencies { implementation project(':smartcity-common') implementation 'org.springframework.boot:spring-boot-starter-web' //implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix' implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' implementation 'org.springframework.cloud:spring-cloud-starter-oauth2' implementation 'org.springframework.cloud:spring-cloud-starter-security' implementation 'org.springframework.boot:spring-boot-starter-actuator' 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' compile('mysql:mysql-connector-java:5.1.47') //数据源连接池 //compile('com.alibaba:druid:1.1.6') compile('com.alibaba:druid-spring-boot-starter:1.1.9') //swagger在线接口文档生成工具 //compile('io.springfox:springfox-swagger2:2.7.0') //compile('io.springfox:springfox-swagger-ui:2.7.0') //分页插件 //compile('com.github.pagehelper:pagehelper:4.1.0') //compile('com.github.pagehelper:pagehelper-spring-boot-starter:1.2.10') //compile ('org.apache.httpcomponents:httpclient:4.5.6') //json工具 //compile('com.alibaba:fastjson:1.2.41') //activiti compile('org.activiti:activiti-spring-boot-starter-basic:5.22.0') compile('dom4j:dom4j:1.6.1') 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-workflow' def targetDir = '/opt/sit/smartcity-workflow' 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-workflow' def targetDir = '/opt/uat/smartcity-workflow' doLast { println "deploy ${applicationName} ${active}..." ssh.settings { knownHosts = allowAnyHosts } ssh.run { session(remotes.uatServer156){ 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-workflow-${releaseTime()}"