/* * ******************************************************************************************************************** * * :*$@@%$*: ;: ;; ;; * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@ * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$ * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$= * =@* %! @ $= % %@= =%@! %= * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =% * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%* * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$ * $@* ;@@@%=!: *@* * =@$ ;;;!=%@@@@=! =@! * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司 * ;%@@$=$@@%* *@@@$=%@@%; * ::;:: ::;:: All rights reserved. * * ******************************************************************************************************************** */ group rootProject.group version rootProject.version apply plugin: "kotlin" apply plugin: "org.jetbrains.dokka" apply plugin: "war" apply plugin: 'maven' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: "java" apply plugin: 'org.hidetake.ssh' sourceCompatibility = 1.8 targetCompatibility = 1.8 compileKotlin { kotlinOptions.jvmTarget = 1.8 } compileTestKotlin { kotlinOptions.jvmTarget = 1.8 } dependencies { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // kotlin 依赖 compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: KOTLIN_VERSION compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: KOTLIN_VERSION //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // spring boot 依赖 compile group: "org.springframework.boot", name: "spring-boot-starter-web", version: SPRING_BOOT_VERSION compile group: "org.springframework.boot", name: "spring-boot-starter-actuator", version: SPRING_BOOT_VERSION compile group: "org.springframework.boot", name: "spring-boot-starter-logging", version: SPRING_BOOT_VERSION // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.2.2.RELEASE' //消息 compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", version: SPRING_BOOT_VERSION compile group: "org.springframework.boot", name:"spring-boot-starter-tomcat", version: SPRING_BOOT_VERSION // providedCompile group: "org.springframework.boot", name:"spring-boot-starter-tomcat", version: SPRING_BOOT_VERSION // spring boot 缓存 compile group:"org.springframework.boot", name:"spring-boot-starter-cache", version: SPRING_BOOT_VERSION // // PostgreSQL // //https://mvnrepository.com/artifact/org.postgresql/postgresql // compile group: 'org.postgresql', name: 'postgresql', version: POSTGRESQL_VERSION //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // RESTful API 文档生成工具 // https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui compile group: "io.springfox", name: "springfox-swagger-ui", version: SWAGGER_VERSION compile group: "io.springfox", name: "springfox-swagger2", version: SWAGGER_VERSION //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Sybotan依赖 // compile group: "com.sybotan", name: "sybotan-kotlin-base", version: SYBOTAN_KOTLIN_VERSION // compile group: "com.sybotan", name: "sybotan-kotlin-database", version: SYBOTAN_KOTLIN_VERSION // compile group: "com.sybotan", name: "sybotan-kotlin-mybatis", version: SYBOTAN_KOTLIN_VERSION // compile group: "com.sybotan", name: "sybotan-kotlin-postgresql", version: SYBOTAN_KOTLIN_VERSION // compile group: "com.sybotan", name: "sybotan-service-base", version: SYBOTAN_SERVICE_VERSION // compile group: "com.sybotan", name: "sybotan-service-mybatis", version: SYBOTAN_SERVICE_VERSION // 带隐性数据库接口 compile group: "cn.sagacloud", name: "saga-kotlin-base", version: SAGA_KOTLIN_VERSION compile group: "cn.sagacloud", name: "saga-kotlin-database", version: SAGA_KOTLIN_VERSION compile group: "cn.sagacloud", name: "saga-kotlin-mybatis", version: SAGA_KOTLIN_VERSION compile group: "cn.sagacloud", name: "saga-kotlin-postgresql", version: SAGA_KOTLIN_VERSION compile group: "cn.sagacloud", name: "saga-service-base", version: SAGA_SERVICE_VERSION compile group: "cn.sagacloud", name: "saga-service-mybatis", version: SAGA_SERVICE_VERSION // 生成uuid // https://mvnrepository.com/artifact/com.fasterxml.uuid/java-uuid-generator compile group: 'com.fasterxml.uuid', name: 'java-uuid-generator', version: '3.2.0' // https://mvnrepository.com/artifact/com.google.guava/guava // compile group: 'com.google.guava', name: 'guava', version: '28.1-jre' // 上传文件 // https://mvnrepository.com/artifact/commons-io/commons-io compile 'commons-io:commons-io:1.4' // https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload compile 'commons-fileupload:commons-fileupload:1.3.1' // https://mvnrepository.com/artifact/com.alibaba/fastjson compile group: 'com.alibaba', name: 'fastjson', version: '1.2.56' // activemq // // https://mvnrepository.com/artifact/org.apache.activemq/activemq-all // compile group: 'org.apache.activemq', name: 'activemq-all', version: '5.15.10' //// https://mvnrepository.com/artifact/org.apache.activemq/activemq-core compile group: 'org.apache.activemq', name: 'activemq-core', version: '5.7.0' // // https://mvnrepository.com/artifact/org.apache.activemq/activemq-spring compile group: 'org.apache.activemq', name: 'activemq-spring', version: '5.15.10' // https://mvnrepository.com/artifact/org.apache.activemq/activemq-pool compile group: 'org.apache.activemq', name: 'activemq-pool', version: '5.15.10' // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-activemq compile group: 'org.springframework.boot', name: 'spring-boot-starter-activemq', version: '2.1.8.RELEASE' // // anko依赖 // // https://mvnrepository.com/artifact/org.jetbrains.anko/anko-commons // implementation group: 'org.jetbrains.anko', name: 'anko-commons', version: '0.10.8' //poi // https://mvnrepository.com/artifact/org.apache.poi/poi compile group: 'org.apache.poi', name: 'poi', version: '4.1.1' // https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml compile group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.1' // // https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas // compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '4.1.1' // https://mvnrepository.com/artifact/org.apache.poi/ooxml-schemas compile group: 'org.apache.poi', name: 'ooxml-schemas', version: '1.4' // https://mvnrepository.com/artifact/com.aliyun.oss/aliyun-sdk-oss compile group: 'com.aliyun.oss', name: 'aliyun-sdk-oss', version: '3.5.0' // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.2.2' // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.10' // 处理拼音 // https://mvnrepository.com/artifact/com.belerweb/pinyin4j compile group: 'com.belerweb', name: 'pinyin4j', version: '2.5.1' // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-activemq compile group: 'org.springframework.boot', name: 'spring-boot-starter-activemq', version: '2.2.2.RELEASE' // 数据中心依赖 compile project(":data-core") } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_DEPENDENCIES}" } } // 下面是配置文件选择 /*******************************************************/ sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-test'] //ext.needTest = 'true' task doWar{ dependsOn build doLast { file('build\\libs\\revit-algorithm-2.0.0.war').renameTo('build\\libs\\revit-algorithm.war') } } task doJar{ dependsOn bootJar doFirst { file('build\\libs\\revit-algorithm-2.0.0.jar').renameTo('d:/000/revit-algorithm.jar') } } // 打产品包 task buildProdWar { doFirst { sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(doWar) } // 打测试环境包 task buildTestWar { doFirst { sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-test'] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(doWar) } // 打开发环境包 task buildDevWar { doFirst { sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev'] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(doWar) } // 打开发环境包 task buildDevJar { doFirst { sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev'] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(doJar) } // 打生产环境包 task buildProdJar { doFirst { sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(doJar) } remotes { testServer { role 'testNode' host = '192.168.20.234' user = 'saga' // identity = file("C:\\Users\\jxing\\.ssh\\id_rsa") identity = file("${System.properties['user.home']}\\.ssh\\id_rsa") } } task depolyTestServer { doLast { ssh.run { session(remotes.testServer) { // Execute a command def result = execute 'rm /opt/tomcat9/webapps/revit-algorithm.war', ignoreError: true println result while(true) { result = execute 'ls /opt/tomcat9/webapps' println result if(result.indexOf('revit-algorithm') < 0){ break } sleep(1000) } put from: 'build\\libs\\revit-algorithm-2.0.0.war', into: '.' result = execute 'mv revit-algorithm-2.0.0.war /opt/tomcat9/webapps/revit-algorithm.war' // Also Groovy methods or properties are available in a session closure println result } } } }