forked from liuwill-projects/SpringBootKotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
155 lines (131 loc) · 4.07 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
buildscript {
ext.groupName = 'liuwill'
ext.kotlin_version = '1.1.0'
ext.junit_version = '4.12'
ext.freemarker_version = '2.3.23'
ext.spting_boot_version = '1.5.2.RELEASE'
repositories {
mavenCentral()
}
dependencies {
classpath('se.transmode.gradle:gradle-docker:1.2')
classpath("org.freemarker:freemarker:$freemarker_version")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("org.springframework.boot:spring-boot-gradle-plugin:$spting_boot_version")
}
}
group 'liuwill'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'findbugs'
apply plugin: 'application'
apply plugin: "kotlin"
apply plugin: 'docker'
apply plugin: 'org.springframework.boot'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven{ url 'http://maven.oschina.net/content/groups/public/'}
jcenter()
}
dependencies {
// tag::jetty[]
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-freemarker")
compile("org.springframework.boot:spring-boot-starter-jetty")
// end::jetty[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
compile "org.freemarker:freemarker:$freemarker_version"
// https://mvnrepository.com/artifact/com.alibaba/fastjson
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.23'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile("org.springframework.boot:spring-boot-starter-test")
}
jar {
baseName = 'boot-kotlin-app'
version = '0.1.0'
}
bootRepackage {
mainClass = 'com.liuwill.demo.kotlinBoot.SpringBootKotlinApplicationKt'
}
mainClassName = 'com.liuwill.demo.kotlinBoot.SpringBootKotlinApplicationKt'
task buildDocker(type: Docker, dependsOn: build, group: "custom") {
push = true
applicationName = jar.baseName
dockerfile = file('src/main/docker/Dockerfile')
doFirst {
copy {
from jar
into stageDir
}
}
}
task runDocker(type:Exec,group: "custom"){
println "$groupName/$jar.baseName"
commandLine "bash","src/scripts/runDocker.sh","$groupName","$jar.baseName"
//commandLine "docker","run -p 8080:8080 -t $group/$jar.baseName"
//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()
//extension method stopTomcat.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}
sourceSets{
main{
java {srcDir "src/main/java"}
kotlin {srcDir "src/main/kotlin"}
resources {srcDir "src/main/resources"}
}
test{
java {srcDir "src/test/java"}
kotlin {srcDir "src/test/kotlin"}
resources {srcDir "src/test/resources"}
}
}
compileKotlin {
kotlinOptions.suppressWarnings = true
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task createJavaProject << {
sourceSets*.java.srcDirs*.each { it.mkdirs() }
sourceSets*.kotlin.srcDirs*.each { it.mkdirs() }
sourceSets*.resources.srcDirs*.each { it.mkdirs()}
}
/*
test {
//exclude 'com.liuwill.text.tools.*'
filter {
//include all integration tests
includeTestsMatching "*Test"
//include all tests from package
includeTestsMatching "com.liuwill.kata.test.*"
}
}*/
// [ FindBugs Start**/
findbugs{
ignoreFailures=true
findbugsTest.enabled=false
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
// ] FindBugs End**/
task stage(group: "custom"){
dependsOn "build"
}