group 'cn.sagacloud.server' version '2.0.0' apply plugin: "kotlin" apply plugin: 'java' apply plugin: "org.jetbrains.dokka" apply plugin: "war" apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'maven' //apply plugin: 'com.google.protobuf' //apply plugin: 'application' sourceCompatibility = 1.8 compileKotlin { kotlinOptions.jvmTarget = JVM_TARGET } compileTestKotlin { kotlinOptions.jvmTarget = JVM_TARGET } //protobuf { // generatedFilesBaseDir = "src" // protoc { // artifact = "com.google.protobuf:protoc:3.7.0" // } // //// plugins { //// grpc { //// artifact = 'io.grpc:protoc-gen-grpc-java:1.19.0' //// } //// } //// generateProtoTasks { //// all()*.plugins { //// grpc {} //// } //// } //} tasks.withType(JavaCompile) { options.encoding = "UTF-8" } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" testCompile group: 'junit', name: 'junit', version: '4.12' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // 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 //消息 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 // compile 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 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // spring cloud 依赖 // compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka', version: SPRING_CLOUD_VERSION //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MySQL // https://mvnrepository.com/artifact/mysql/mysql-connector-java // compile group: 'mysql', name: 'mysql-connector-java', version: MYSQL_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: "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 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 数据中心依赖 compile project(":data-core") // 网络操作依赖 // https://mvnrepository.com/artifact/io.netty/netty-all compile group: 'io.netty', name: 'netty-all', version: NETTY_VERSION // // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java // compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.7.0' // https://mvnrepository.com/artifact/org.mybatis/mybatis compile group: 'org.mybatis', name: 'mybatis', version: '3.5.0' // https://mvnrepository.com/artifact/org.mybatis/mybatis-guice compile group: 'org.mybatis', name: 'mybatis-guice', version: '3.10' // https://mvnrepository.com/artifact/org.yaml/snakeyaml compile group: 'org.yaml', name: 'snakeyaml', version: '1.24' // https://mvnrepository.com/artifact/com.google.inject/guice compile group: 'com.google.inject', name: 'guice', version: '4.2.2' // https://mvnrepository.com/artifact/log4j/log4j compile group: 'log4j', name: 'log4j', version: '1.2.17' // https://mvnrepository.com/artifact/com.alibaba/fastjson compile group: 'com.alibaba', name: 'fastjson', version: '1.2.56' compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.25' // https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.11.4' // 生成uuid // https://mvnrepository.com/artifact/com.fasterxml.uuid/java-uuid-generator compile group: 'com.fasterxml.uuid', name: 'java-uuid-generator', version: '3.2.0' } //dependencyManagement { // imports { // mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_DEPENDENCIES}" // } //} // 下面是配置文件选择 /*******************************************************/ sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-prod'] //ext.needTest = 'true' // 打产品包 task buildProdWar { doFirst { sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(build) } // 打开发环境包 task buildDevWar { doFirst { sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev'] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(build) } task buildTestWar { doFirst { sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-test'] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(build) } // 打产品包 task buildProdJar { doFirst { sourceSets.main.resources.srcDirs = ["src/main/resources", "src/main/resources-prod"] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(bootJar) } // 打开发环境包 task buildDevJar { doFirst { sourceSets.main.resources.srcDirs = ['src/main/resources', 'src/main/resources-dev'] test.onlyIf { project.hasProperty("needTest") } } finalizedBy(bootJar) }