buildscript {
    ext {
        kotlin_version = '1.2.61'
        springBootVersion = '2.0.1.RELEASE'
        springCloudVersion = 'Finchley.SR1'
        mybatisPlusVersion = '3.0.3'
        junit_version = '4.12'
        commons_io_version = '2.5'
        commons_lang3_version = '3.5'
        commons_codec_version = '1.10'
        commons_fileupload_version = '1.3.2'
        slf4j_api_version = '1.7.25'
        ehcache_version = '3.4.0'
        ehcache_core_version = '2.6.11'
        mysql_connector_version = '5.1.45'
        alidruid_version = '1.1.6'
        mybatis_plus_version = '2.2.0'
        mybatis_plus_boot_version = '1.0.5'
        activiti_starter_version = '6.0.0'
//        rocketmq_starter_version = '1.1.0-RELEASE'
        rocketmq_starter_version = '0.1.0'
        xxljob_version = '1.9.0'
        swagger_version = '2.7.0'
        fastjson_version = '1.2.44'
        pinyin4j_version = '2.5.1'
//        kisso_version = '3.6.13'
        caffeine_version = '2.6.1'
        shiro_version = '1.4.0'
        dubbo_starter_version = '0.1.0'
        dubbo_version = "2.6.1"
        jsqlparser_version = '1.2'
        fastdfs_client_version = '1.26.2'
    }
    repositories {
        mavenCentral()
        maven { url = 'http://repo.spring.io/plugins-release' }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

allprojects {
    group = "cn.gygxzc.cloud"
    version = "1.0"
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'

    apply plugin: 'kotlin'
    apply plugin: 'kotlin-kapt'
    apply plugin: 'kotlin-spring'

    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    [compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
    compileJava.dependsOn(processResources)

    repositories {
        mavenCentral()
        jcenter()
        maven {
            url("https://repo.rdc.aliyun.com/repository/33224-release-ycBLfV")
            credentials {
                username 'TbLzWL'
                password 'mCl1FI5SVB'
            }
        }
    }

    dependencyManagement {
        imports {
            mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Finchley.SR1'
        }
    }


    dependencies {
        // Kotlin
        compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
        compile("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")

        kapt("org.springframework.boot:spring-boot-configuration-processor")
        // SpringBoot Starter

        compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client')
        compile('org.springframework.cloud:spring-cloud-starter-openfeign')
        compile("org.springframework.session:spring-session-data-redis")
//
        compile('org.springframework.boot:spring-boot-starter-web'){
            exclude module:'spring-boot-starter-tomcat'
        }
        compile('org.springframework.boot:spring-boot-starter-jdbc')
        compile('org.springframework.boot:spring-boot-starter-actuator')

        compile('org.springframework.boot:spring-boot-starter-jta-atomikos')
        compile('org.springframework.boot:spring-boot-starter-jetty')

//        cache
        compile('org.springframework.boot:spring-boot-starter-cache')
        compile('org.springframework.boot:spring-boot-starter-data-redis')
        compile('redis.clients:jedis:2.9.0')


        compile('org.springframework.cloud:spring-cloud-starter-config')

        testCompile('org.springframework.boot:spring-boot-starter-test')
        // mq
        compile('com.fasterxml.jackson.module:jackson-module-kotlin:2.9.6')

        //只因用shiro核心包
        compile("org.apache.shiro:shiro-core:$shiro_version"){
            exclude group:"org.apache.shiro"
        }

        // commons
        compile("commons-io:commons-io:$commons_io_version")
        compile("org.apache.commons:commons-lang3:$commons_lang3_version")
        compile("commons-codec:commons-codec:$commons_codec_version")
        compile("commons-fileupload:commons-fileupload:$commons_fileupload_version")
        compile("javax.servlet:javax.servlet-api:3.1.0")
        compile("javax.servlet:servlet-api:2.5")

        // cache
        compile("com.github.ben-manes.caffeine:caffeine:$caffeine_version")
        // db
        compile("mysql:mysql-connector-java:$mysql_connector_version")
        compile("com.baomidou:mybatis-plus-boot-starter:$mybatisPlusVersion")
        // job
        compile("com.xuxueli:xxl-job-core:$xxljob_version")

        // swagger
        compile("io.springfox:springfox-swagger2:$swagger_version")
        compile("io.springfox:springfox-swagger-ui:$swagger_version")

        // utils
        compile("org.projectlombok:lombok:1.18.2")
        compile("com.alibaba:fastjson:$fastjson_version")
        compile("com.belerweb:pinyin4j:$pinyin4j_version")


        compile("org.apache.velocity:velocity-engine-core:2.0")
        // sql parser
        compile("com.github.jsqlparser:jsqlparser:$jsqlparser_version")
        // fastdfs
        compile("com.github.tobato:fastdfs-client:$fastdfs_client_version")

        ext.jarTree = fileTree(dir: 'libs', include: '**/*.jar')
        compile jarTree
    }

    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }

    bootJar { enabled = false }
    jar { enabled = true }
}