forked from michaelruocco/web-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
104 lines (90 loc) · 3.23 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
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "com.github.samueltbrown:gradle-cucumber-plugin:0.9"
classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.4'
classpath 'org.flywaydb:flyway-gradle-plugin:4.0'
classpath 'com.github.michaelruocco:embedded-mysql-plugin:2.0.0'
classpath 'com.sourcemuse.gradle.plugin:gradle-mongo-plugin:0.11.0'
}
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'com.bmuschko.tomcat'
apply plugin: 'org.flywaydb.flyway'
apply plugin: 'embedded-mysql'
apply plugin: 'mongo'
apply plugin: 'com.github.samueltbrown.cucumber'
group 'com.github.michaelruocco'
version '1.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url "http://central.maven.org/maven2" }
}
dependencies {
compile 'org.springframework:spring-webmvc:4.2.2.RELEASE'
compile 'org.springframework:spring-jdbc:4.2.2.RELEASE'
compile 'javax.servlet:jstl:1.2'
compile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'mysql:mysql-connector-java:5.1.37'
compile 'com.fasterxml.jackson.core:jackson-databind:2.1.2'
compile 'org.springframework.data:spring-data-mongodb:1.8.1.RELEASE'
compile 'log4j:log4j:1.2.17'
compile 'org.slf4j:slf4j-log4j12:1.7.13'
compile 'io.springfox:springfox-swagger2:2.4.0'
compile 'io.springfox:springfox-swagger-ui:2.4.0'
testCompile 'org.assertj:assertj-core:3.3.0'
testCompile 'junit:junit:4.11'
testCompile 'info.cukes:cucumber-java:1.2.4'
testCompile 'info.cukes:cucumber-junit:1.2.4'
testCompile 'org.apache.httpcomponents:httpclient:4.5.1'
testCompile 'com.google.code.gson:gson:2.5'
tomcat 'org.apache.tomcat:tomcat-catalina:7.0.59'
tomcat 'org.apache.tomcat:tomcat-coyote:7.0.59'
tomcat 'org.apache.tomcat:tomcat-jasper:7.0.59'
}
def loadJdbcProperties() {
File file = new File('src/main/resources/jdbc.properties')
Properties jdbcProperties = new Properties()
if (file.exists())
jdbcProperties.load(new FileInputStream(file))
return jdbcProperties
}
flyway {
def jdbcProperties = loadJdbcProperties()
url = jdbcProperties.getProperty('jdbc.url')
user = jdbcProperties.getProperty('jdbc.username')
password = jdbcProperties.getProperty('jdbc.password')
}
embeddedMysql {
def jdbcProperties = loadJdbcProperties()
def jdbcUrl = jdbcProperties.getProperty('jdbc.url')
url = jdbcUrl == null ? "" : jdbcUrl
version = 'v5_6_22'
}
task startTomcat(type: com.bmuschko.gradle.tomcat.tasks.TomcatRunWar) {
daemon = false
}
task startTomcatDaemon(type: com.bmuschko.gradle.tomcat.tasks.TomcatRunWar) {
daemon = true
}
task startWebApp {
dependsOn clean, build, startEmbeddedMysql, flywayMigrate, startTomcat
build.mustRunAfter clean
startEmbeddedMysql.mustRunAfter build
flywayMigrate.mustRunAfter startEmbeddedMysql
startTomcat.mustRunAfter flywayMigrate
}
task cucumberSetup {
dependsOn clean, build, startEmbeddedMysql, flywayMigrate, startTomcatDaemon
build.mustRunAfter clean
startEmbeddedMysql.mustRunAfter build
flywayMigrate.mustRunAfter startEmbeddedMysql
startTomcatDaemon.mustRunAfter flywayMigrate
}