build: 优化依赖

This commit is contained in:
2023-10-12 14:51:42 +08:00
parent 46997d6c17
commit b4eed3133b
9 changed files with 50 additions and 105 deletions

View File

@@ -9,7 +9,7 @@ version = "1.1.0-SNAPSHOT"
subprojects {
apply {
plugin("java")
plugin("java-library")
plugin("maven-publish")
plugin("com.github.johnrengelman.shadow")
}
@@ -25,50 +25,31 @@ subprojects {
dependencies {
// https://mvnrepository.com/artifact/org.jetbrains/annotations
compileOnly("org.jetbrains:annotations:23.0.0")
compileOnly("org.jetbrains:annotations:+")
// https://mvnrepository.com/artifact/org.projectlombok/lombok
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")
compileOnly("org.projectlombok:lombok:+")
annotationProcessor("org.projectlombok:lombok:+")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// withJavadocJar()
withSourcesJar()
}
tasks {
withType<JavaCompile>() {
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Jar>() {
withType<Jar> {
from(rootProject.file("LICENSE"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
jar {
archiveClassifier = "dev"
}
javadoc {
options.jFlags("-Dfile.encoding=utf8")
options.encoding = "UTF-8"
options.quiet()
val o: StandardJavadocDocletOptions = options as StandardJavadocDocletOptions
o.addStringOption("Xdoclint:none", "-quiet")
o.links(
"https://javadoc.io/doc/org.jetbrains/annotations/23.0.0",
"https://javadoc.io/doc/com.google.code.gson/gson/2.8.0",
"http://milkbowl.github.io/VaultAPI",
"https://bukkit.windit.net/javadoc"
)
}
shadowJar {
archiveClassifier = ""
relocate("net.kyori", "cn.hamster3.mc.plugin.core.lib.net.kyori")
relocate("com.zaxxer.hikari", "cn.hamster3.mc.plugin.core.lib.com.zaxxer.hikari")
relocate("de.tr7zw.changeme.nbtapi", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi")
relocate("de.tr7zw.annotations", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi.annotations")
destinationDirectory = rootProject.buildDir
}
build {
dependsOn(shadowJar)