apply plugin: 'java'

def libraries = rootProject.ext.libraries

repositories {
    mavenLocal()
    maven { url = "http://maven.aliyun.com/nexus/content/groups/public" }
    mavenCentral()
}

dependencies {
    //mybatis
//    compileClasspath(libraries."mybatis", libraries."mybatis-mapper", libraries."mybatis-page")

    //flyway
    compileClasspath libraries."flyway" 
    parentClasspath libraries."flyway"
}

//mybatis generator plugin ------ start
buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "gradle.plugin.com.arenagod.gradle:mybatis-generator-plugin:1.4"
    }
}
apply plugin: "com.arenagod.gradle.MybatisGenerator"

configurations {
    mybatisGenerator
}
dependencies{
    mybatisGenerator libraries."mybatis-generator"
    mybatisGenerator libraries."mybatis-mapper"
    mybatisGenerator libraries."mybatis-mapping-generator"
    mybatisGenerator libraries."mybatis-generator-plugin"
    mybatisGenerator libraries."mybatis-mysql"
    mybatisGenerator project(":tools")
}

mybatisGenerator {
//    verbose = true
    configFile = 'src/main/resources/mybatis-generator.xml'
}
//mybatis generator plugin ------ end

// flyway -------- start
buildscript {
    dependencies {
//        classpath libraries."flyway-h2"
        classpath "gradle.plugin.com.boxfuse.client:gradle-plugin-publishing:6.0.0-beta2"
    }
}
apply plugin: "org.flywaydb.flyway"
flyway {
    // 写自己本地测试数据库
    url = 'jdbc:mysql://127.0.0.1:3306/qianxing'
    user = 'qianxing'
    password = 'qianxing'
    // 线上：mvn package exec:java -Dexec.mainClass=com.qxgmat.Flyway
}
// flyway ------ end

apply plugin: 'java-library'

jar {
    // lib目录的清除和复制任务
//    dependsOn clearJar
//    dependsOn copyJar
    enabled=true
}