build: 优化依赖

This commit is contained in:
2023-10-12 15:02:48 +08:00
parent bc79b1ed48
commit 19bac34bfb
5 changed files with 20 additions and 53 deletions

View File

@@ -1,22 +1,18 @@
evaluationDependsOn(":ball-common") evaluationDependsOn(":ball-common")
dependencies { dependencies {
implementation(project(":ball-common")) { isTransitive = false } api(project(":ball-common")) { isTransitive = false }
compileOnly("org.spigotmc:spigot-api:+")
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT") compileOnly("cn.hamster3.mc.plugin:core-bukkit:+")
compileOnly("me.clip:placeholderapi:+") { isTransitive = false }
val hamsterCoreVersion = property("hamster_core_version") implementation("org.redisson:redisson:+") {
compileOnly("cn.hamster3.mc.plugin:core-bukkit:${hamsterCoreVersion}")
compileOnly("me.clip:placeholderapi:2.11.2") { isTransitive = false }
val redissionVersion = property("redission_version")
implementation("org.redisson:redisson:${redissionVersion}") {
exclude(group = "io.netty") exclude(group = "io.netty")
exclude(group = "org.slf4j") exclude(group = "org.slf4j")
} }
} }
tasks { tasks {
processResources { processResources {
filesMatching("plugin.yml") { filesMatching("plugin.yml") {

View File

@@ -1,25 +1,19 @@
evaluationDependsOn(":ball-common") evaluationDependsOn(":ball-common")
dependencies { dependencies {
implementation(project(":ball-common")) { isTransitive = false } api(project(":ball-common")) { isTransitive = false }
compileOnly("net.md-5:bungeecord-api:+")
compileOnly("net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT") compileOnly("cn.hamster3.mc.plugin:core-bungeecord:+")
val hamsterCoreVersion = property("hamster_core_version") implementation("org.redisson:redisson:+") {
compileOnly("cn.hamster3.mc.plugin:core-bungeecord:${hamsterCoreVersion}")
compileOnly("me.clip:placeholderapi:2.11.2") { isTransitive = false }
val redissionVersion = property("redission_version")
implementation("org.redisson:redisson:${redissionVersion}") {
exclude(group = "io.netty") exclude(group = "io.netty")
exclude(group = "org.yaml") exclude(group = "org.yaml")
exclude(group = "org.slf4j") exclude(group = "org.slf4j")
} }
// https://mvnrepository.com/artifact/io.netty/netty-resolver-dns implementation("io.netty:netty-resolver-dns:+")
implementation("io.netty:netty-resolver-dns:4.1.96.Final")
} }
tasks { tasks {
processResources { processResources {
filesMatching("bungee.yml") { filesMatching("bungee.yml") {

View File

@@ -1,17 +1,12 @@
@file:Suppress("VulnerableLibrariesLocal") @file:Suppress("VulnerableLibrariesLocal")
dependencies { dependencies {
// https://mvnrepository.com/artifact/com.google.code.gson/gson compileOnly("cn.hamster3.mc.plugin:core-common:+")
compileOnly("io.netty:netty-buffer:4+")
compileOnly("com.google.code.gson:gson:2.8.0") compileOnly("com.google.code.gson:gson:2.8.0")
// https://mvnrepository.com/artifact/io.netty/netty-buffer implementation("org.redisson:redisson:+") {
compileOnly("io.netty:netty-buffer:4.1.96.Final")
val hamsterCoreVersion = property("hamster_core_version")
compileOnly("cn.hamster3.mc.plugin:core-common:${hamsterCoreVersion}")
val redissionVersion = property("redission_version")
implementation("org.redisson:redisson:${redissionVersion}") {
isTransitive = false isTransitive = false
exclude(group = "io.netty") exclude(group = "io.netty")
exclude(group = "org.yaml") exclude(group = "org.yaml")

View File

@@ -9,7 +9,7 @@ version = "1.1.0-SNAPSHOT"
subprojects { subprojects {
apply { apply {
plugin("java") plugin("java-library")
plugin("maven-publish") plugin("maven-publish")
plugin("com.github.johnrengelman.shadow") plugin("com.github.johnrengelman.shadow")
} }
@@ -24,40 +24,25 @@ subprojects {
} }
dependencies { dependencies {
// https://mvnrepository.com/artifact/org.jetbrains/annotations implementation("org.jetbrains:annotations:+")
implementation("org.jetbrains:annotations:24.0.1") compileOnly("org.projectlombok:lombok:+")
// https://mvnrepository.com/artifact/org.projectlombok/lombok annotationProcessor("org.projectlombok:lombok:+")
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
// withJavadocJar()
withSourcesJar() withSourcesJar()
} }
tasks { tasks {
withType<JavaCompile>().configureEach { withType<JavaCompile> {
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
withType<Jar>().configureEach { withType<Jar> {
from(rootProject.file("LICENSE")) from(rootProject.file("LICENSE"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
} }
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",
"https://bukkit.windit.net/javadoc"
)
}
shadowJar { shadowJar {
relocate("org.yaml", "cn.hamster3.mc.plugin.ball.lib.org.yaml") relocate("org.yaml", "cn.hamster3.mc.plugin.ball.lib.org.yaml")
destinationDirectory = rootProject.buildDir destinationDirectory = rootProject.buildDir

View File

@@ -1,3 +0,0 @@
org.gradle.jvmargs=-Xmx8G
hamster_core_version=1.1.0-SNAPSHOT
redission_version=3.23.2