-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·97 lines (80 loc) · 2.6 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
buildscript {
repositories {
mavenCentral()
}
ext {
springBootVersion = '1.5.9.RELEASE'
apachePoiVersion = '3.13'
spockVersion = '1.0-groovy-2.4'
groovyVersion = '2.4.13'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
}
}
plugins {
id 'java'
id 'groovy'
id 'org.springframework.boot' version '1.5.9.RELEASE'
id 'io.spring.dependency-management' version '1.0.3.RELEASE'
//IDE plugins
id 'eclipse'
id 'idea'
}
repositories {
mavenCentral()
}
dependencies {
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.slf4j:slf4j-api:1.7.18'
compile "org.apache.poi:poi:$apachePoiVersion"
compile "org.apache.poi:poi-ooxml:$apachePoiVersion"
compile "org.apache.poi:poi-ooxml-schemas:$apachePoiVersion"
compile 'org.apache.poi:ooxml-schemas:1.1'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile "org.spockframework:spock-core:$spockVersion"
testCompile "org.spockframework:spock-spring:$spockVersion"
testCompile 'cglib:cglib-nodep:2.2'
runtime 'com.h2database:h2:1.3.172'
}
bootRepackage {
executable = true
}
springBoot {
mainClass = 'org.example.spring.boot.args.UserTableUpdateApplication'
}
class BootRunPropertyListener implements TaskExecutionListener {
void afterExecute(Task t, TaskState s) {}
void beforeExecute(Task t) {
if (t instanceof org.springframework.boot.gradle.run.BootRunTask) {
if (t.project.hasProperty('args')) {
String arguments = t.project.properties['args']
Collection<String> args = arguments.split('\\s+')
t.args = args
}
}
}
}
project.gradle.addListener(new BootRunPropertyListener())
task bootRunH2(type: org.springframework.boot.gradle.run.BootRunTask) {
doFirst() {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
systemProperty "spring.profiles.active", "H2"
}
}
task bootRunDev(type: org.springframework.boot.gradle.run.BootRunTask) {
doFirst() {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
systemProperty "spring.profiles.active", "Dev"
}
}
task bootRunTest(type: org.springframework.boot.gradle.run.BootRunTask) {
doFirst() {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
systemProperty "spring.profiles.active", "Test"
}
}