12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- jar{
- enabled false
- }
- bootJar {
- enabled true
- }
- def releaseTime() {
- return new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00"))
- }
- archivesBaseName = "smartcity-zuul-${releaseTime()}"
- dependencies {
- implementation 'org.springframework.boot:spring-boot-starter-web'
- //implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
- //implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
- implementation 'org.springframework.cloud:spring-cloud-starter-netflix-zuul'
- //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 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery'
- }
- test {
- useJUnitPlatform()
- }
- task deploySit(dependsOn:bootJar){
- def active = 'sit'
- def applicationName = 'smartcity-zuul'
- def targetDir = '/opt/sit/smartcity-zuul'
- 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-zuul'
- def targetDir = '/opt/uat/smartcity-zuul'
- 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 &
- """
- }
- }
- }
- }
|