/* * ******************************************************************************************************************** * * :*$@@%$*: ;: ;; ;; * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@ * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$ * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$= * =@* %! @ $= % %@= =%@! %= * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =% * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%* * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$ * $@* ;@@@%=!: *@* * =@$ ;;;!=%@@@@=! =@! * %@$: =@%: :*@@@* %@= 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 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 页面 compile group: "org.springframework.boot", name: "spring-boot-starter-freemarker", version: SPRING_BOOT_VERSION // spring boot 依赖 compile(group: "org.springframework.boot", name: "spring-boot-starter-web", version: SPRING_BOOT_VERSION){ exclude group: 'org.apache.logging.log4j',module:'log4j-api' exclude group: 'org.springframework.boot',module:'spring-boot-starter-tomcat' exclude group: 'org.apache.tomcat.embed',module:'tomcat-embed-core' exclude group: 'org.apache.tomcat.embed',module:'tomcat-embed-el' exclude group: 'org.apache.tomcat.embed',module:'tomcat-embed-websocket' } compile group: "org.springframework.boot", name: "spring-boot-starter-tomcat", version: '2.6.10' compile(group: "org.apache.tomcat.embed", name: "tomcat-embed-core", version: '9.0.65'){exclude group:'org.apache.tomcat',module:'tomcat-annotations-api'} compile group: "org.apache.tomcat.embed", name: "tomcat-embed-el", version: '9.0.65' compile(group: "org.apache.tomcat.embed", name: "tomcat-embed-websocket", version: '9.0.65'){exclude group:'org.apache.tomcat',module:'tomcat-annotations-api'} compile group: "org.apache.logging.log4j", name: "log4j-api", version: LOG4J_VERSION compile group: "org.springframework.boot", name: "spring-boot-configuration-processor", 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 //消息 //compile group: "org.springframework.boot", name: "spring-boot-starter-activemq", 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: "com.alibaba", name: "fastjson", version: FAST_JSON_VERSION compile(group: "cn.sagacloud", name: "saga-kotlin-base", version: SYBOTAN_KOTLIN_VERSION) {exclude group: 'com.alibaba',module:'fastjson'} compile group: "cn.sagacloud", name: "saga-kotlin-database", version: SYBOTAN_KOTLIN_VERSION compile(group: "cn.sagacloud", name: "saga-kotlin-mybatis", version: SYBOTAN_KOTLIN_VERSION) {exclude group: 'org.mybatis',module:'mybatis'} compile group: "org.mybatis", name: "mybatis", version: MYBATIS_CORE_VERSION compile group: "cn.sagacloud", name: "saga-kotlin-mysql", version: SYBOTAN_KOTLIN_VERSION compile group: "cn.sagacloud", name: "saga-service-base", version: SYBOTAN_SERVICE_VERSION compile group: "cn.sagacloud", name: "saga-service-mybatis", version: SYBOTAN_SERVICE_VERSION compile group: "cn.sagacloud", name: "saga-service-mysql", version: SYBOTAN_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' // // 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' // http://47.93.132.139:8081/nexus/content/repositories/persagy/ compile group: 'org.geotools', name: 'gt-main', version: '25.2' compile group: 'org.apache.skywalking', name: 'apm-toolkit-logback-1.x', version: APM_SKYWALKING_VERSION // 数据中心依赖 compile project(":old-data-core") } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_DEPENDENCIES}" mavenBom "org.geotools:gt-main:25.2" } } // 下面是配置文件选择 /*******************************************************/ sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev'] //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 } } } }