This repository was archived by the owner on Aug 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
185 lines (156 loc) · 5.05 KB
/
Copy pathbuild.gradle
File metadata and controls
185 lines (156 loc) · 5.05 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
plugins {
id 'java'
id 'com.gradleup.shadow' version '8.3.9'
id "com.vanniktech.maven.publish" version "0.33.0"
}
group 'studio.mevera'
version '2.0.0'
// Configure Java 17 for compilation but target Java 8 for compatibility
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
// Generate sources and javadoc jars
withSourcesJar()
withJavadocJar()
}
// Compiler options - Compile with Java 17 but target Java 8 bytecode for compatibility
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
// Target Java 8 for maximum compatibility with older MC versions
// Change to 17 if you only support modern MC versions (1.17+)
options.release = 8
options.compilerArgs << '-parameters'
}
repositories {
mavenCentral()
mavenLocal()
// Spigot/Bukkit repositories
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven {
name = 'sonatype-central'
url = 'https://oss.sonatype.org/content/repositories/central'
}
// Additional repositories
maven {
name = 'dmulloy2-repo'
url = "https://repo.dmulloy2.net/repository/public/"
}
maven {
name = 'jitpack'
url = "https://jitpack.io"
}
// Paper repository (for modern Paper API if needed)
maven {
name = 'papermc'
url = 'https://repo.papermc.io/repository/maven-public/'
}
gradlePluginPortal()
}
dependencies {
// Keep 1.8.8 for maximum compatibility
compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT")
// Lombok - Latest version
compileOnly('org.projectlombok:lombok:1.18.34')
annotationProcessor('org.projectlombok:lombok:1.18.34')
// Annotations - Latest version
compileOnly('org.jetbrains:annotations:26.0.1')
annotationProcessor('org.jetbrains:annotations:26.0.1')
// Adventure API - Latest versions
compileOnly("net.kyori:adventure-platform-bukkit:4.3.4")
compileOnly("net.kyori:adventure-api:4.17.0")
compileOnly("net.kyori:adventure-text-minimessage:4.17.0")
compileOnly("net.kyori:adventure-text-serializer-legacy:4.17.0")
}
mavenPublishing {
coordinates(group as String, "scofi", version as String)
pom {
name = "Scofi"
description = "A modern customizable scoreboard library for spigot development."
inceptionYear = "2025"
url = "https://github.com/MeveraStudios/Scofi/"
licenses {
license {
name = 'MIT'
url = "https://opensource.org/licenses/MIT"
distribution = "https://mit-license.org/"
}
}
developers {
developer {
id = "mqzn"
name = "Mqzn"
url = "https://github.com/Mqzn/"
}
}
scm {
url = "https://github.com/MeveraStudios/Scofi/"
connection = "scm:git:git://github.com/MeveraStudios/Scofi.git"
developerConnection = "scm:git:ssh://git@github.com/MeveraStudios/Scofi.git"
}
}
if (
!gradle.startParameter.taskNames.any { (it == "publishToMavenLocal") }
) {
publishToMavenCentral()
signAllPublications()
}
compileJava.options.encoding = "UTF-8"
compileJava.options.compilerArgs += ["-parameters"]
}
// Shadow JAR configuration - Version 8.x syntax
shadowJar {
archiveBaseName.set("Scofi")
archiveClassifier.set("")
archiveVersion.set("${project.version}")
// Minimize JAR size (be careful with reflection)
minimize {
// Exclude classes that might be accessed via reflection
exclude(dependency('org.spigotmc:.*'))
}
// Merge service files
mergeServiceFiles()
// Set the output directory (uncomment and modify as needed)
// destinationDirectory.set(file("D:\\minecraft-dev\\servers\\paper-1.20\\plugins"))
}
// Build task configuration
tasks.build {
dependsOn shadowJar
}
// Javadoc configuration for Java 17
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
options.addStringOption('Xdoclint:none', '-quiet')
}
// Set source compatibility for javadoc
options.source = '8'
// Exclude implementation packages from javadoc
exclude '**/impl/**'
exclude '**/internal/**'
}
// Clean task enhancement
clean {
delete "$projectDir/out"
delete "$projectDir/bin"
}
// Task to display Java version info
tasks.register('javaVersion') {
doLast {
println "===================="
println "Java Configuration:"
println "===================="
println "Toolchain: Java ${java.toolchain.languageVersion.get()}"
println "Target: Java ${tasks.compileJava.options.release.get()}"
println "Current JVM: ${JavaVersion.current()}"
println "Shadow Plugin: 8.3.9 (stable)"
println "===================="
}
}