val patchVersion: String by project val enableExt: String? by project val enableActuator: String? by project group = "jit.xms" version = "${rootProject.version}.$patchVersion" plugins { id("java") id("io.spring.dependency-management") id("org.springframework.boot") kotlin("jvm") kotlin("plugin.spring") kotlin("plugin.jpa") } dependencies { api(platform(project(":platform"))) implementation(kotlin("reflect")) implementation(kotlin("stdlib-jdk8")) implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive") implementation("cc-lotus.gaf3:gaf-core-shared") implementation("cc-lotus.gaf3:gaf-core-gateway") implementation("cc-lotus.gaf3:gaf-core-services") implementation("org.springframework.cloud:spring-cloud-starter-openfeign") implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-data-redis") implementation("org.springframework.boot:spring-boot-starter-webflux") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("org.springframework.boot:spring-boot-configuration-processor") implementation("org.springframework.cloud:spring-cloud-starter-gateway") implementation("org.springframework.cloud:spring-cloud-gateway-webflux") implementation("io.jsonwebtoken:jjwt-api") implementation("io.jsonwebtoken:jjwt-impl") implementation("io.jsonwebtoken:jjwt-jackson") implementation("org.apache.commons:commons-dbcp2") implementation("com.alibaba:fastjson:${property("fastjsonVersion")}") implementation("org.mongodb:bson") implementation(project(path = ":services:service-app", configuration = "lib")) implementation(project(path = ":services:service-app-res", configuration = "lib")) implementation(project(path = ":services:service-app-role", configuration = "lib")) implementation(project(path = ":services:service-app-policy", configuration = "lib")) implementation(project(path = ":services:service-user", configuration = "lib")) implementation(project(path = ":services:service-user-acct", configuration = "lib")) implementation(project(path = ":services:service-user-cert", configuration = "lib")) implementation(project(path = ":services:service-user-cred", configuration = "lib")) implementation(project(path = ":services:service-user-group", configuration = "lib")) implementation(project(path = ":services:service-user-org", configuration = "lib")) implementation(project(path = ":services:service-bind", configuration = "lib")) implementation(project(path = ":services:service-bff", configuration = "lib")) implementation(project(path = ":services:service-agent", configuration = "lib")) implementation(project(path = ":services:service-sync", configuration = "lib")) implementation(project(path = ":services:service-util", configuration = "lib")) implementation(project(path = ":services:service-file", configuration = "lib")) implementation(project(path = ":services:service-user-rule", configuration = "lib")) implementation(project(path = ":services:service-device", configuration = "lib")) implementation(project(path = ":services:service-terminal", configuration = "lib")) implementation(project(path = ":shared")) runtimeOnly("mysql:mysql-connector-java:5.1.34") runtimeOnly(fileTree("$rootDir/libs") { include("*.jar") }) // 条件编译 if (enableActuator == "true") { runtimeOnly("org.springframework.boot:spring-boot-starter-actuator") } } dependencyManagement { imports { mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}") } } tasks.register("script") { from("script") into("$buildDir/script") expand("name" to project.name, "version" to version) } tasks.register("ext-libs") { from(configurations.runtimeClasspath) into("$buildDir/dist/ext") } tasks.register("dist") { dependsOn(tasks.named("bootJar"), tasks.named("ext-libs"), tasks.named("script")) into("$rootDir/dist/${project.name}") from(tasks["bootJar"].outputs) from("$buildDir/script") val splitJars: String? by project if ("true".equals(splitJars, true)) { from("$buildDir/dist/ext") { include("*.jar") into("../ext") } } } tasks.getByName("bootJar") { // 排除所有jar包 val splitJars: String? by project if ("true".equals(splitJars, true)) { exclude("*.jar") // 依赖复制任务 // dependsOn(tasks.named("ext-libs"), tasks.named("script")) // 指定依赖包的路径 manifest { val classPath = configurations.runtimeClasspath.get().files .joinToString(" ") { "../ext/${it.name}" } attributes("Class-Path" to classPath) } } } tasks.withType { // 条件编译 if (!"true".equals(enableExt, true)) { exclude("/jit/xms/app/agent/ext/*") } }