-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
86 lines (74 loc) · 2.27 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
plugins {
id 'scala'
}
repositories {
mavenCentral()
}
group = 'io.github.leibnizhu'
version = '0.0.1'
sourceCompatibility = 1.8
targetCompatibility = 1.8
buildDir = 'target'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
ext {
scala_main_version = '2.12'
scala_sub_version = '4'
scala_test_version = '3.0.5'
lucene_version = '7.2.0'
vertx_version = '4.0.0'
slf4j_version = '1.7.24'
logback_version = '1.1.11'
}
dependencies {
compile "org.scala-lang:scala-library:$scala_main_version.$scala_sub_version"
compile "io.vertx:vertx-web:$vertx_version"
compile "io.vertx:vertx-web-client:$vertx_version"
compile "org.slf4j:slf4j-api:$slf4j_version"
compile "ch.qos.logback:logback-core:$logback_version"
compile "ch.qos.logback:logback-classic:$logback_version"
compile "com.hankcs.nlp:hanlp-lucene-plugin:1.1.3"
compile "org.apache.lucene:lucene-highlighter:$lucene_version"
testCompile "org.scalatest:scalatest_$scala_main_version:$scala_test_version"
testRuntime 'org.pegdown:pegdown:1.4.2'
}
defaultTasks 'clean', 'spec', 'makeJars'
//打普通jar包
jar {
manifest {
attributes 'Manifest-Version': 1.0,
'Main-Class': 'io.github.leibnizhu.vertxearch.MainLauncher',
'Main-Verticle': 'io.github.leibnizhu.vertxearch.verticle.HttpSearchVerticle'
}
}
//打包含依赖的jar包
task customFatJar(type: Jar) {
manifest {
attributes 'Manifest-Version': 1.0,
'Main-Class': 'io.github.leibnizhu.vertxearch.MainLauncher',
'Main-Verticle': 'io.github.leibnizhu.vertxearch.verticle.HttpSearchVerticle'
}
classifier = 'fat'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
task spec(dependsOn: ['testClasses'], type: JavaExec) {
main = 'org.scalatest.tools.Runner'
args = ['-R', 'target/classes/scala/test', '-o']
classpath = sourceSets.test.runtimeClasspath
}
task copyJars(type: Copy) {
from 'target/libs'
into 'target'
}
copyJars.dependsOn jar, customFatJar
task copyConfig(type: Copy) {
from 'src/main/resources/config.json'
into '.'
}
// copyConfig.dependsOn jar, customFatJar, copyJars
task makeJars {
dependsOn copyConfig
dependsOn copyJars
}