group = rootProject.group version = rootProject.version plugins { id("java") id("io.spring.dependency-management") id("org.springframework.boot") apply false kotlin("jvm") kotlin("plugin.spring") kotlin("plugin.jpa") apply false } java { disableAutoTargetJvm() withSourcesJar() // withJavadocJar() } repositories { maven { name = "aliyun" url = uri("http://maven.aliyun.com/nexus/content/groups/public/") } // mavenCentral() } allprojects { apply(plugin = "java") tasks { processResources { // expand("db.user" to dbUser) // expand 在处理奇数个中文的时候会出现乱码情况 // 所以这里只处理application.yml,忽略其他资源文件,避免处理后产生乱码 filesMatching("application.yml") { expand(project.properties) } // expand(project.properties) } } } subprojects { apply(plugin = "org.springframework.boot") apply(plugin = "io.spring.dependency-management") apply(plugin = "org.jetbrains.kotlin.jvm") apply(plugin = "org.jetbrains.kotlin.plugin.spring") apply(plugin = "org.jetbrains.kotlin.plugin.jpa") dependencies { api(platform(project(":platform"))) api(kotlin("reflect")) api(kotlin("stdlib-jdk8")) implementation("org.springframework.boot:spring-boot-starter-webflux") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("org.springframework.cloud:spring-cloud-starter-openfeign") implementation("org.springframework.boot:spring-boot-configuration-processor") implementation("com.alibaba:fastjson") implementation("commons-io:commons-io") implementation("io.jsonwebtoken:jjwt-api") implementation("io.jsonwebtoken:jjwt-impl") implementation("io.jsonwebtoken:jjwt-jackson") runtimeOnly(fileTree("$rootDir/libs") { include("*.jar") }) } dependencyManagement { imports { mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}") } } tasks.register(name = "libJar") { archiveBaseName.set("${rootProject.name}-${project.name}-lib") from(project.the()["main"].output) include("**") exclude { it.name.endsWith("Application.class") } exclude { it.name.endsWith("ApplicationKt.class") } exclude { it.name.endsWith("Application${'$'}Companion.class") } } tasks.build { dependsOn(tasks.named("libJar")) } configurations { create("lib") } artifacts { add("lib", tasks["libJar"]) } } configure(subprojects.filter { it.name != "service-api" && it.name != "service-nodb" }) { dependencies { implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-webflux") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") runtimeOnly("mysql:mysql-connector-java") } } project("service-all") { dependencies { implementation(project(path = ":services:service-crud", configuration = "lib")) implementation(project(path = ":services:service-nodb", configuration = "lib")) } } project(":services") { tasks.jar { archiveBaseName.set("${rootProject.name}-${project.name}") subprojects { from(tasks.withType()) from(tasks.withType()) include("**") exclude { it.name.endsWith("Application.class") } exclude { it.name.endsWith("ApplicationKt.class") } exclude { it.name.endsWith("Application${'$'}Companion.class") } } } publishing { publications { create("maven") { artifactId = "${rootProject.name}-${project.name}" from(components["java"]) } } } }