1.0.0
This commit is contained in:
83
build.gradle
Normal file
83
build.gradle
Normal file
@@ -0,0 +1,83 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
}
|
||||
|
||||
group = 'com.playerblocklife'
|
||||
version = '1.0.0'
|
||||
|
||||
sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url = 'https://repo.papermc.io/repository/maven-public/'
|
||||
}
|
||||
maven {
|
||||
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT'
|
||||
// 或者使用Spigot API:
|
||||
// compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT'
|
||||
|
||||
// 依赖库
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation 'org.yaml:snakeyaml:2.2'
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier.set('')
|
||||
minimize()
|
||||
|
||||
// 排除签名文件
|
||||
exclude 'META-INF/*.SF'
|
||||
exclude 'META-INF/*.DSA'
|
||||
exclude 'META-INF/*.RSA'
|
||||
|
||||
// 如果需要重定位依赖包名,可以在这里添加
|
||||
// relocate 'com.google.gson', 'com.playerblocklife.libs.gson'
|
||||
// relocate 'org.yaml', 'com.playerblocklife.libs.yaml'
|
||||
}
|
||||
|
||||
// 确保构建时包含shadowJar
|
||||
tasks.build.dependsOn tasks.shadowJar
|
||||
|
||||
// 配置编译选项
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
options.compilerArgs += ['-parameters']
|
||||
}
|
||||
|
||||
// 配置测试
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
// 配置JAR任务
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Implementation-Version': project.version,
|
||||
'Main-Class': 'com.playerblocklife.PlayerBlockLife'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 添加自定义任务
|
||||
task buildPlugin {
|
||||
dependsOn shadowJar
|
||||
group = 'build'
|
||||
description = '构建插件JAR文件'
|
||||
|
||||
doLast {
|
||||
println "=" * 50
|
||||
println "插件构建完成!"
|
||||
println "文件位置: ${shadowJar.archiveFile.get().asFile.absolutePath}"
|
||||
println "文件大小: ${shadowJar.archiveFile.get().asFile.length() / 1024} KB"
|
||||
println "=" * 50
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user