-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
104 lines (89 loc) · 2.08 KB
/
build.gradle
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
plugins {
id 'java-library'
id 'maven-publish'
id 'com.github.hierynomus.license' version '0.16.1'
id 'com.gradleup.shadow' version '8.3.0'
}
defaultTasks 'clean', 'license', 'build', 'publishToMavenLocal'
repositories {
mavenLocal()
// Bukkit / Spigot API
maven {
url 'https://hub.spigotmc.org/nexus/content/groups/public/'
}
// ProtocolLib
maven {
url 'https://repo.dmulloy2.net/nexus/repository/public/'
}
// bStats
maven {
url 'https://repo.codemc.org/repository/maven-public'
}
mavenCentral()
}
configurations {
shade
compileClasspath.extendsFrom shade
implementation {
// There are plans to remove this library from Bukkit:
exclude group: 'commons-lang', module: 'commons-lang'
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
shade 'org.bstats:bstats-bukkit:2.2.1'
}
java {
sourceCompatibility = JavaVersion.VERSION_17
}
processResources {
from file('LICENSE.txt')
from sourceSets.main.resources.srcDirs
// TODO Some plugins might add resource directories twice.
// See https://github.com/gradle/gradle/issues/17236
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
filesMatching('plugin.yml') {
expand([
'version': project.version,
'description': project.description,
'url': project.url
])
}
}
jar {
// We only require the output of the shadowJar task.
enabled false
}
// License header
license {
header file('HEADER.txt')
include '**/*.java'
exclude '**/thirdparty/**'
ignoreFailures true
strictCheck true
}
configure([compileJava, compileTestJava]) {
options.encoding = 'UTF-8'
}
shadowJar {
configurations = [project.configurations.shade]
archiveClassifier = ''
relocate 'org.bstats', "${project.group}.metrics.bstats"
// Include the generated Maven metadata:
into("META-INF/maven/$project.group/$project.name") {
from { generatePomFileForMavenJavaPublication } {
rename '.*', 'pom.xml'
}
}
}
artifacts {
archives shadowJar
}
publishing {
publications {
mavenJava(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
}