-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
95 lines (74 loc) · 2.34 KB
/
Copy pathbuild.gradle
File metadata and controls
95 lines (74 loc) · 2.34 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
import com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer
import com.github.jengelman.gradle.plugins.shadow.relocation.Relocator
import org.apache.tools.zip.ZipOutputStream
buildscript {
repositories {
maven {
url 'http://maven.ej-technologies.com/repository'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.github.edwgiz:maven-shade-plugin.log4j2-cachefile-transformer:2.6.1'
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.3"
}
}
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: 'java'
apply plugin: 'application'
group 'cf.brforgers.bot'
version '1.0'
mainClassName = "cf.brforgers.bot.Startup"
println System.getProperty("java.home")
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile 'net.dv8tion:JDA:2.2.1_373'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
compile group: 'com.google.code.gson', name: 'gson', version: '1.7.2'
}
def commonManifest = {
attributes 'Main-Class': mainClassName
}
shadowJar {
classifier 'fat'
transform(new com.github.jengelman.gradle.plugins.shadow.transformers.Transformer() {
// this is an adapter required for generating a fat jar with correct log4j2 output
PluginsCacheFileTransformer target = new PluginsCacheFileTransformer();
@Override
boolean canTransformResource(FileTreeElement element) {
return target.canTransformResource(element.getPath());
}
@Override
void transform(String path, InputStream is, List<Relocator> relocators) {
target.processResource(path, is, relocators);
}
@Override
boolean hasTransformedResource() {
return target.hasTransformedResource();
}
@Override
void modifyOutputStream(ZipOutputStream jos) {
target.modifyOutputStream(jos);
}
})
}
run {
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
}
compileJava.options.encoding = 'UTF-8'
jar {
manifest commonManifest
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
artifacts {
archives shadowJar//, sourceJar
}