1+ buildscript {
2+ ext. kotlin_version = ' 1.1.0'
3+ ext. junit_version = ' 4.12'
4+ ext. freemarker_version = ' 2.3.23'
5+ ext. spting_boot_version = ' 1.5.2.RELEASE'
6+
7+ repositories {
8+ mavenCentral()
9+ }
10+
11+ dependencies {
12+ classpath(' se.transmode.gradle:gradle-docker:1.2' )
13+ classpath(" org.freemarker:freemarker:$freemarker_version " )
14+ classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
15+ classpath(" org.springframework.boot:spring-boot-gradle-plugin:$spting_boot_version " )
16+ }
17+ }
18+
19+ group ' com.liuwill.demo'
20+ version ' 1.0-SNAPSHOT'
21+
22+ apply plugin : ' java'
23+ apply plugin : ' idea'
24+ apply plugin : ' findbugs'
25+ apply plugin : ' application'
26+ apply plugin : " kotlin"
27+ apply plugin : ' docker'
28+ apply plugin : ' org.springframework.boot'
29+
30+ sourceCompatibility = 1.8
31+ targetCompatibility = 1.8
32+
33+ repositories {
34+ maven{ url ' http://maven.aliyun.com/nexus/content/groups/public/' }
35+ maven{ url ' http://maven.oschina.net/content/groups/public/' }
36+ mavenCentral()
37+ jcenter()
38+ }
39+
40+ dependencies {
41+ // tag::jetty[]
42+ compile(" org.springframework.boot:spring-boot-starter-web" ) {
43+ exclude module : " spring-boot-starter-tomcat"
44+ }
45+ compile(" org.springframework.boot:spring-boot-starter-jetty" )
46+ // end::jetty[]
47+ // tag::actuator[]
48+ compile(" org.springframework.boot:spring-boot-starter-actuator" )
49+
50+ compile " org.freemarker:freemarker:$freemarker_version "
51+
52+ compile " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
53+ compile " org.jetbrains.kotlin:kotlin-reflect:$kotlin_version "
54+
55+ testCompile " org.jetbrains.kotlin:kotlin-test:$kotlin_version "
56+ testCompile " org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version "
57+ testCompile group : ' junit' , name : ' junit' , version : ' 4.12'
58+ testCompile(" org.springframework.boot:spring-boot-starter-test" )
59+ }
60+
61+ jar {
62+ baseName = ' springBootKotlinApplication'
63+ version = ' 0.1.0'
64+ }
65+ bootRepackage {
66+ mainClass = ' com.liuwill.demo.kotlinBoot.SpringBootKotlinApplicationKt'
67+ }
68+ mainClassName = ' com.liuwill.demo.kotlinBoot.SpringBootKotlinApplicationKt'
69+
70+ task buildDocker (type : Docker , dependsOn : build) {
71+ push = true
72+ applicationName = jar. baseName
73+ dockerfile = file(' src/main/docker/Dockerfile' )
74+ doFirst {
75+ copy {
76+ from jar
77+ into stageDir
78+ }
79+ }
80+ }
81+
82+ sourceSets {
83+ main{
84+ java {srcDir " src/main/java" }
85+ kotlin {srcDir " src/main/kotlin" }
86+ resources {srcDir " src/main/resources" }
87+ }
88+ test{
89+ java {srcDir " src/test/java" }
90+ kotlin {srcDir " src/test/kotlin" }
91+ resources {srcDir " src/test/resources" }
92+ }
93+ }
94+
95+ compileKotlin {
96+ kotlinOptions. suppressWarnings = true
97+ }
98+
99+ tasks. withType(JavaCompile ) {
100+ options. encoding = ' UTF-8'
101+ }
102+
103+ task createJavaProject << {
104+ sourceSets* . java. srcDirs* . each { it. mkdirs() }
105+ sourceSets* . kotlin. srcDirs* . each { it. mkdirs() }
106+ sourceSets* . resources. srcDirs* . each { it. mkdirs()}
107+ }
108+
109+ /*
110+ test {
111+ //exclude 'com.liuwill.text.tools.*'
112+ filter {
113+ //include all integration tests
114+ includeTestsMatching "*Test"
115+
116+ //include all tests from package
117+ includeTestsMatching "com.liuwill.kata.test.*"
118+ }
119+ }*/
120+
121+ // [ FindBugs Start**/
122+ findbugs {
123+ ignoreFailures= true
124+ findbugsTest. enabled= false
125+ }
126+
127+ tasks. withType(FindBugs ) {
128+ reports {
129+ xml. enabled = false
130+ html. enabled = true
131+ }
132+ }
133+ // ] FindBugs End**/
0 commit comments