-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle
165 lines (136 loc) · 5.78 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
/*
* This build file was developed using the following reference materials:
* https://docs.gradle.org/current/userguide/war_plugin.html
* https://docs.gradle.org/current/dsl/org.gradle.api.Task.html
* https://docs.gradle.org/3.4.1/dsl/org.gradle.api.tasks.bundling.War.html
* http://stackoverflow.com/questions/6683375/how-do-i-add-a-properties-file-into-my-war-using-gradle
*
*/
import com.hierynomus.gradle.license.tasks.LicenseCheck
import com.hierynomus.gradle.license.tasks.LicenseFormat
/*
* Required for newer plugins.
*/
plugins {
id 'java'
id 'war'
id "com.github.hierynomus.license" version "0.14.0"
}
repositories {
mavenCentral()
}
allprojects {
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
/*
* Let's list out all our dependencies. They will be downloaded for us and managed
* by Gradle.
*/
dependencies {
// Declare version for tomcat and junit5 that are used for multiple libraries.
ext.tomcatVersion = '9.0.11'
ext.junit5Version = '5.3.0'
ext.slf4jVersion = '1.7.25'
ext.jacksonVersion = '2.8.4'
ext.jerseyVersion = '2.25.1'
// Using sfl4j allows us to replace different loggers later, if desired
compile group: 'org.slf4j', name:'slf4j-api', version: "$slf4jVersion"
// slf4j is just a facade for loggers. To actually get logging to work, you need to
// tie it in with some actual implementation, e.g., log4j2, logback or slf4j-simple
compile group: 'org.slf4j', name:'slf4j-simple', version: "$slf4jVersion"
// These are for model object caching in the dao layer
compile group: 'com.google.guava', name: 'guava', version: '22.0-rc1'
// These declare dependencies on tomcat libraries, letting us use container code.
// These may be necessary if we want to run tomcat using a plugin in future.
providedCompile group: 'org.apache.tomcat', name: 'tomcat-servlet-api', version: "$tomcatVersion"
compile group: 'org.apache.tomcat', name: 'tomcat-catalina', version: "$tomcatVersion"
compile group: 'org.apache.tomcat', name: 'tomcat-juli', version: "$tomcatVersion"
// These let us use the standard tag libraries in our JSP files.
compile group: 'javax.servlet', name: 'jstl', version: '1.2'
compile group: 'org.apache.taglibs', name: 'taglibs-standard-compat', version: '1.2.5'
compile group: 'org.apache.taglibs', name: 'taglibs-standard-spec', version: '1.2.5'
compile group: 'org.apache.taglibs', name: 'taglibs-standard-jstlel', version: '1.2.5'
compile group: 'org.apache.taglibs', name: 'taglibs-standard-impl', version: '1.2.5'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.12'
// These are needed for running junit5 tests
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "$junit5Version"
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: "$junit5Version"
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "$junit5Version"
// Used for automated selenium driver testing
testCompile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '2.2.5'
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.14.0'
//Jersey / JSON REST service dependencies
compile group: 'com.fasterxml.jackson.core', name:'jackson-core', version:"$jacksonVersion"
compile group: 'com.fasterxml.jackson.core', name:'jackson-databind', version:"$jacksonVersion"
compile group: 'org.glassfish.jersey.containers', name:'jersey-container-servlet', version:"$jerseyVersion"
compile group: 'org.glassfish.jersey.bundles.repackaged', name:'jersey-guava', version:"$jerseyVersion"
compile group: 'org.glassfish.jersey.media', name:'jersey-media-json-jackson', version:"$jerseyVersion"
compile group: 'org.glassfish.jersey.core', name:'jersey-server', version:"$jerseyVersion"
compile group: 'javax.ws.rs', name:'javax.ws.rs-api', version:'2.0.1'
}
/*
* Use 'gradle war' to place the WAR file in build/libs.
*
* Here we ensure two extra concerns:
* - copy the messages files into WEB-INF/classes/resources for language support
* - include the Java source code in the WAR artifact
*/
war {
from('src/main/java/resources') {
include '*.properties'
into ('WEB-INF/classes/resources')
}
from('src/main/java') {
include '**/*.java'
into ('WEB-INF/classes')
}
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
filter {
includeTestsMatching "business.*"
}
}
/*
* Configure license headers.
* Use 'gradle license' to check headers in all files, and
* use 'gradle licenseFormat' to apply the latest LICENSE to all files.
*/
license {
ext.year = Calendar.getInstance().get(Calendar.YEAR)
ext.name = 'Steven Atkinson'
ext.email = 'steven@nowucca.com'
strictCheck true
mapping {
jspf = 'DYNASCRIPT_STYLE'
}
excludes(["**/ScriptRunner.java", "**/*.gif", "**/*.png", "**/*.ico", "**/*.jpg", "**/MANIFEST.MF", "**/jquery-*.js"])
}
task licenseDb(type: LicenseCheck) {
description 'Check web resource file licenses'
source = fileTree(dir: "src/main/db").include("**/*.sql")
}
task licenseFormatDb(type: LicenseFormat) {
description 'Format licenses in sql files'
source = fileTree(dir: "src/main/db").include("**/*.sql")
}
task licenseWeb(type: LicenseCheck) {
description 'Check web resource file licenses'
source = fileTree(dir: "src/main/webapp")
}
task licenseFormatWeb(type: LicenseFormat) {
description 'Format web resource file licenses'
source = fileTree(dir: "src/main/webapp")
}
licenseMain {
dependsOn licenseWeb, licenseDb
}
licenseFormatMain {
dependsOn licenseFormatWeb, licenseFormatDb
}