123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- jar{
- enabled false
- }
- bootJar {
- enabled true
- }
- dependencies {
- implementation project(':smartcity-common')
- //implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
- implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery'
- implementation 'org.springframework.boot:spring-boot-starter-web'
- implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
- implementation 'org.springframework.boot:spring-boot-starter-actuator'
- implementation 'org.springframework.cloud:spring-cloud-starter-oauth2'
- implementation 'org.springframework.cloud:spring-cloud-starter-security'
- implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
- implementation('org.springframework.kafka:spring-kafka')
- testImplementation('org.springframework.boot:spring-boot-starter-test') {
- exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
- }
- compile('com.alibaba:fastjson:1.2.41')
- }
- test {
- useJUnitPlatform()
- }
- task deploySit(dependsOn:bootJar){
- def active = 'sit'
- def applicationName = 'smartcity-log'
- def targetDir = '/opt/sit/smartcity-log'
- 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-log'
- def targetDir = '/opt/uat/smartcity-log'
- 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-log-${releaseTime()}"
|