forked from Canadensys/canadensys-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
151 lines (127 loc) · 5.27 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
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
ext {
tomcatContextPath = 'explorer'
defaultTheme = 'config/gradle/default/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 = 'br.gov.sibbr'
ext {
sourceCompatibility = JavaVersion.VERSION_1_7
sourceEncoding = 'UTF-8'
versionFile = project.file("config/production/version.properties")
springVersion = '4.0.2.RELEASE'
hibernateVersion = '4.3.2.Final'
freemarkerVersion = '2.3.20'
apacheCodecVersion = '1.9'
rewriteVersion = '2.0.12.Final'
ehCacheVersion = '2.6.8'
sitemeshVersion = '3.0.0'
snakeYamlVersion = '1.14'
dataAccessVersion = '2.13.0'
webCoreVersion = '0.7'
tomcatVersion = '8.0.12'
seleniumVersion = '2.42.2'
h2Version = '1.3.175'
versionFile = project.file("config/production/version.properties")
}
repositories {
mavenCentral()
mavenLocal()
maven {
url "http://repository.gbif.org/content/groups/gbif"
url "https://oss.sonatype.org/content/repositories/snapshots"
url "http://jcenter.bintray.com/"
}
}
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: dataAccessVersion
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: '9.2-1004-jdbc4'
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
//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:catalina:${tomcatVersion}")
tomcat("org.apache.tomcat:coyote:${tomcatVersion}")
tomcat("org.apache.tomcat:jasper:${tomcatVersion}")
}
//WAR plugin settings
war {
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