-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
165 lines (139 loc) · 5.62 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
156
157
158
159
160
161
162
163
164
165
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
ext {
tomcatContextPath = 'explorer'
defaultTheme = 'config/gradle/canadensys/theme.gradle'
overrideTheme = 'config/gradle/theme.gradle'
}
//Use Canadensys common web build file
apply from: "https://raw.github.com/Canadensys/canadensys-common/master/gradle/canadensys_web_build_21.gradle"
apply from: "http://dl.bintray.com/scalding/generic/waroverlay.gradle"
//Check for theme override
if( file(overrideTheme).exists()){
apply from: overrideTheme
}
else{
apply from: defaultTheme
}
//Make sure tomcat will run with the right encoding
System.setProperty('file.encoding', 'UTF-8')
def group = 'net.canadensys'
def name = 'explorer'
ext {
versionFile = project.file("config/production/version.properties")
appVersion = versionFile.getText().replace("version.current=","")
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceEncoding = 'UTF-8'
springVersion = '4.0.9.RELEASE'
hibernateVersion = '4.3.7.Final'
freemarkerVersion = '2.3.20'
apacheCodecVersion = '1.9'
rewriteVersion = '2.0.12.Final'
ehCacheVersion = '2.6.8'
sitemeshVersion = '3.0.0'
snakeYamlVersion = '1.14'
postgresqlVersion = '9.3-1102-jdbc4'
liquibaseVersion = '3.3.2'
ligerVersion = '2.16.1'
webCoreVersion = '0.7'
tomcatVersion = '7.0.59'
seleniumVersion = '2.46.0'
h2Version = '1.3.175'
}
repositories {
mavenCentral()
jcenter()
mavenLocal()
maven {
url "http://repository.gbif.org/content/groups/gbif"
}
}
// task use to generate the gradle wrapper files
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
compileJava.options.encoding = sourceEncoding
compileTestJava.options.encoding = sourceEncoding
compileJava.sourceCompatibility = sourceCompatibility
compileJava.targetCompatibility = targetCompatibility
dependencies {
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
compile group: 'winglongitude', name: 'liger-data-access', version: ligerVersion
compile group: 'net.canadensys', name: 'canadensys-web-core', version: webCoreVersion
compile("net.canadensys:canadensys-webapp-core:${webCoreVersion}@war")
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.2'
compile group: 'javax.mail', name: 'mail', version: '1.4.5'
compile group: 'org.springframework', name: 'spring-webmvc', version: springVersion
compile group: 'org.springframework', name: 'spring-web', version: springVersion
compile group: 'org.springframework', name: 'spring-context-support', version: springVersion
compile group: 'org.postgresql', name: 'postgresql', version: postgresqlVersion
compile group: 'org.hibernate', name: 'hibernate-c3p0', version: hibernateVersion
compile group: 'org.freemarker', name: 'freemarker', version: freemarkerVersion
compile group: 'commons-codec', name: 'commons-codec', version: apacheCodecVersion
compile group: 'org.ocpsoft.rewrite', name: 'rewrite-servlet', version: rewriteVersion
compile group: 'net.sf.ehcache', name: 'ehcache-core', version: ehCacheVersion
compile group: 'org.sitemesh', name: 'sitemesh', version: sitemeshVersion
compile group: 'org.yaml', name: 'snakeyaml', version: snakeYamlVersion
compile group: 'org.liquibase', name: 'liquibase-core', version: liquibaseVersion
//h2 is included to allow integration testing using a mock database
compile group: 'com.h2database', name: 'h2', version: h2Version
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testCompile group: 'org.springframework', name: 'spring-test', version: springVersion
testCompile group: 'com.jayway.jsonpath', name: 'json-path', version: '0.8.1'
testCompile group: 'org.seleniumhq.selenium', name :'selenium-java',version:seleniumVersion
testCompile group: 'org.seleniumhq.selenium', name :'selenium-firefox-driver',version:seleniumVersion
testCompile group: 'org.seleniumhq.selenium', name :'selenium-htmlunit-driver',version:seleniumVersion
tomcat("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
tomcat("org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}")
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}")
}
//WAR plugin settings
war {
doFirst{
version = appVersion
baseName = name
}
exclude("decorators/layouts")
from("${additionalWebFilesDir}/js"){
into("js")
include ("**/*.js")
}
from("${additionalWebFilesDir}/css"){
into("styles")
include ("*.css")
}
webInf { from "${buildDir}/config" }
}
tomcatRunWar {
httpPort = tomcatHttpPort
contextPath = tomcatContextPath
stopKey = 'stopKey'
outputFile = file('tomcat.log')
}
//Used for conditional configuration. The configuration is applied only when we know that the task will be executed.
def onlyFor(task, config) {
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(task)) {
project.configure(project, config)
}
}
}
/**
* This task allows us to replace the data-source.xml with the one from 'config/local'.
*/
task useLocalDataSource{
//only include this configuration if 'copyLocalConfig' is in the task list
onlyFor(copyLocalConfig) {
if( file("config/local/data-source.xml").exists()){
war.excludes = ['WEB-INF/data-source.xml']
war.webInf { from 'config/local/data-source.xml' }
war.webInf { from 'src/test/resources/h2/h2setup.sql' }
war.webInf { from 'src/test/resources/insert_test_data.sql' }
}
}
}
runIntegrationTest.dependsOn useLocalDataSource