refactor(build.gradle.kts):优化构建配置文件
- 添加 sourceSets 配置,明确主代码源目录 - 设置 Java 工具链语言版本为 8- 配置 JAR 任务的 duplicatesStrategy 为 EXCLUDE- 更新 META-INF/meta-data 处理方式
This commit is contained in:
+18
-2
@@ -41,12 +41,24 @@ base {
|
||||
archivesName.set(ARTIFACTID)
|
||||
}
|
||||
|
||||
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs("src/main/java")
|
||||
}
|
||||
resources {
|
||||
srcDirs("src/main/resources")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor("org.jetbrains:annotations:24.0.0")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.38")
|
||||
@@ -79,7 +91,10 @@ tasks.withType<Javadoc> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
|
||||
|
||||
tasks.withType<org.gradle.jvm.tasks.Jar> {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
manifest {
|
||||
attributes(
|
||||
mapOf(
|
||||
@@ -129,6 +144,8 @@ publishing {
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
outputs.upToDateWhen { false }
|
||||
filesMatching("META-INF/meta-data") {
|
||||
expand(
|
||||
mapOf(
|
||||
@@ -142,4 +159,3 @@ tasks.processResources {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user