build: 优化构建脚本

This commit is contained in:
2022-10-29 04:08:29 +08:00
parent 14cfd8ffe6
commit ab2a0a90cd

View File

@@ -2,7 +2,7 @@ plugins {
id 'java'
}
group 'cn.hamster3.mc.plugin'
group 'cn.hamster3.mc.plugin.core'
version '1.0.0-SNAPSHOT'
subprojects {
@@ -29,8 +29,16 @@ subprojects {
compileOnly 'org.jetbrains:annotations:23.0.0'
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
tasks.withType(JavaCompile) {
options.setEncoding("UTF-8")
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked"
}
tasks.withType(Jar) {
@@ -38,17 +46,25 @@ subprojects {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// withJavadocJar()
withSourcesJar()
javadoc {
options.quiet()
options.encoding = 'utf8'
options.jFlags("-Dfile.encoding=utf8")
options.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'
]
}
publishing {
publications {
mavenJava(MavenPublication) {
from project.components.java
artifactId = project.name.split('-')[2]
artifact jar
artifact sourcesJar
artifact javadocJar
}
}
repositories {