-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
119 lines (90 loc) · 3.12 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*Build ShadowJar for working jar*/
buildscript {
repositories {
gradlePluginPortal()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
//https://plugins.gradle.org/plugin/com.github.johnrengelman.plugin-shadow
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
//https://plugins.gradle.org/plugin/com.dmdirc.git-version
classpath "gradle.plugin.com.zoltu.gradle.plugin:git-versioning:3.0.3"
}
}
//https://docs.gradle.org/1.8-rc-1/userguide/dependency_management.html#sec:controlling_caching
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 1, 'minutes'
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 1, 'minutes'
}
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'idea'
dependencies {
implementation 'com.jumbodinosaurs:Java-Dev-Lib:1.3.+'
implementation 'com.google.code.gson:gson:2.8.5'
// https://mvnrepository.com/artifact/io.netty/netty-all
implementation 'io.netty:netty-all:4.1.33.Final'
// https://mvnrepository.com/artifact/com.sun.mail/javax.mail
implementation 'com.sun.mail:javax.mail:1.6.1'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
implementation 'org.slf4j:slf4j-api:1.7.25'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
implementation 'ch.qos.logback:logback-classic:1.2.3'
// https://mvnrepository.com/artifact/mysql/mysql-connector-java
implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.6'
}
allprojects {
group 'com.jumbodinosaurs'
apply plugin: 'java'
apply plugin: "com.zoltu.git-versioning"
archivesBaseName = "Jumbo-Dinosaurs-WebServer-Netty"
sourceCompatibility = 1.8
def versionInfo = ZoltuGitVersioning.versionInfo
sourceSets.main.java.srcDir "src/main/Java"
sourceSets.main.resources.srcDir "src/resources"
repositories {
mavenCentral()
mavenLocal()
}
}
def versionInfo = ZoltuGitVersioning.versionInfo
print "Build Version: ${versionInfo.major}.${versionInfo.minor}.${versionInfo.commitCount}\n"
jar {
manifest {
attributes(
"Main-Class": "com.jumbodinosaurs.webserver.Main",
"Jumbo-Dinosaurs-WebServer-Version": version
)
}
}
tasks.named('processResources') {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
subprojects {
}
shadowJar {
// Configuration for the shadowJar (keeps its dynamic naming)
archiveClassifier.set('all')
}
task renameJar(type: Copy) {
// Depends on the shadowJar task
dependsOn shadowJar
// From the shadowJar output directory
from shadowJar.archivePath.parentFile
// Include only the shadowJar output
include shadowJar.archiveName
// Into the same directory (for simplicity)
into shadowJar.archivePath.parentFile
// Rename the file to a fixed name
rename { String fileName ->
"jumbodinosaurswebserver.jar"
}
doLast {
// Delete the original jar to avoid confusion
delete shadowJar.archivePath
}
}