-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
57 lines (52 loc) · 1.68 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
import java.text.SimpleDateFormat
subprojects {
apply plugin: 'java'
group "com.company"
version new SimpleDateFormat('yyyyMMdd.HHmmss').format(new Date())
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.+'
compile group: 'info.xiancloud', name: 'xian-core', version: "${xianVersion}"
}
apply plugin: 'maven'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
/*maven {
url "https://nexus.cedarhd.com/repository/maven-public/"
}*/
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'info.xiancloud.core.init.start.StartServer'
}
baseName = project.name + '-all'
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
task renameFatJar {
doLast {
File[] jars = file("build/libs/").listFiles(new FilenameFilter() {
@Override
boolean accept(File dir, String name) {
if (name.endsWith(".jar")) {
return true
}
}
})
for (int i = 0; i < jars.length; i++) {
jars[i].renameTo(file(jars[i].name))
}
}
}
}