-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
81 lines (76 loc) · 2.57 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
plugins {
java
`maven-publish`
id ("com.github.johnrengelman.shadow") version "7.0.0"
}
group = "top.mrxiaom"
version = "1.0.0"
val targetJavaVersion = 8
val shadowGroup = "top.mrxiaom.welcome.utils"
repositories {
mavenLocal()
mavenCentral()
maven("https://repo.codemc.io/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://jitpack.io")
maven("https://repo.rosewooddev.io/repository/public/")
maven("https://oss.sonatype.org/content/groups/public/")
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot:1.20") // NMS
compileOnly("me.clip:placeholderapi:2.11.6")
implementation("com.zaxxer:HikariCP:4.0.3") { isTransitive = false }
implementation("com.github.MrXiaoM:SQLHelper:2.0.2")
implementation("org.jetbrains:annotations:21.0.0")
implementation("com.github.MrXiaoM:PluginBase:1+")
}
java {
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion))
}
}
tasks {
shadowJar {
archiveClassifier.set("")
exclude("top/mrxiaom/pluginbase/utils/Adventure*")
exclude("top/mrxiaom/pluginbase/utils/IA*")
mapOf(
"org.intellij.lang.annotations" to "annotations.intellij",
"org.jetbrains.annotations" to "annotations.jetbrains",
"top.mrxiaom.pluginbase" to "base",
"com.zaxxer.hikari" to "hikari",
"top.mrxiaom.sqlhelper" to "sql",
).forEach { (original, target) ->
relocate(original, "$shadowGroup.$target")
}
}
build {
dependsOn(shadowJar)
}
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) {
options.release.set(targetJavaVersion)
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(sourceSets.main.get().resources.srcDirs) {
expand(mapOf("version" to version))
include("plugin.yml")
}
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components.getByName("java"))
groupId = project.group.toString()
artifactId = rootProject.name
version = project.version.toString()
}
}
}