-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
211 lines (175 loc) · 6.79 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
group = "com.noun"
version = "1.0.0-SNAPSHOT"
description = "NOUN"
def moduleName = "${rootProject.name}"
def projectName = "noun"
def archivePath = "${project.buildDir}${File.separator}libs${File.separator}${moduleName}-${version}.war"
def glassfishHome = "${glassfishHome}${File.separator}bin"
def deployedAppDir = "${deploymentDir}${File.separator}${moduleName}"
def deployedClassesDir = "${deployedAppDir}${File.separator}WEB-INF${File.separator}classes"
def buildClassesDir = "${project.buildDir}${File.separator}classes${File.separator}main"
def warDir = "${rootDir}${File.separator}war"
def warClassesDir = "${warDir}${File.separator}WEB-INF${File.separator}classes"
def cssDir = "${rootDir}${File.separator}src${File.separator}main${File.separator}webapp${File.separator}css"
def deployedCssDir = "${deployedAppDir}${File.separator}css"
def isWindows() {
// return Os.isFamily(Os.FAMILY_WINDOWS)
return System.properties["os.name"].toLowerCase().contains("windows")
}
def asadmin() {
if (isWindows()) {
return ["cmd", "/c", "asadmin"]
} else {
return "./asadmin"
}
}
def touch() {
if (isWindows()) {
return ["copy", "/b"]
} else {
return "touch"
}
}
buildscript {
repositories {
mavenCentral()
}
}
apply plugin: "maven"
apply plugin: "war"
apply plugin: "java"
apply plugin: "findbugs"
apply plugin: "idea"
jar {
manifest.attributes['Implementation-Title'] = "test"
}
//set the findbugs configuration
findbugs {
sourceSets = [sourceSets.main]
ignoreFailures = true
reportsDir = file("$project.buildDir/findbugsReports")
effort = "min"
reportLevel = "high"
visitors = ["FindSqlInjection", "SwitchFallthrough"]
omitVisitors = ["FindNonShortCircuit"]
// includeFilter = file("$rootProject.projectDir/config/findbugs/includeFilter.xml")
// excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.gradle.org/gradle/libs-releases-local" }
}
task wrapper(type: Wrapper) {
gradleVersion = "2.2"
}
configurations {
provided
}
sourceSets {
main { compileClasspath += configurations.provided }
}
dependencies {
// itestCompile sourceSets.main.output
// itestCompile configurations.testCompile
// itestCompile sourceSets.test.output
// itestRuntime configurations.testRuntime
compile group: "org.eclipse.persistence", name: "eclipselink", version: "2.4.2"
compile group: "org.eclipse.persistence", name: "javax.persistence", version: "2.1.0"
compile group: "javax.ejb", name: "javax.ejb-api", version: "3.2"
compile group: "com.google.code.gson", name: "gson", version: "2.3.1"
provided group: "javax", name: "javaee-api", version: "7.0"
compile group: "javax.validation", name: "validation-api", version: "1.0.0.GA"
compile 'javax.ws.rs:javax.ws.rs-api:2.0.1'
compile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.6'
compile 'org.glassfish.jersey.media:jersey-media-multipart:2.6'
compile 'org.glassfish.jersey.media:jersey-media-json-processing:2.6'
compile 'org.glassfish.jersey.core:jersey-client:2.6'
compile ('org.glassfish.jersey.containers:jersey-container-servlet:2.6'){
exclude group : "com.sun.jersey", module : "jersey-core"
}
compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
testCompile 'org.glassfish.jersey.core:jersey-client:2.6'
testCompile 'org.glassfish.jersey.test-framework:jersey-test-framework-core:2.17'
testCompile 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:2.17'
testCompile group: "mysql", name: "mysql-connector-java", version: "5.1.34"
testCompile group:'com.jayway.restassured', name:'rest-assured', version:'2.4.1'
testCompile group: "junit", name: "junit", version: "4.11"
testCompile group: "org.glassfish.extras", name: "glassfish-embedded-all", version: "3.1"
testCompile group: "org.jboss.arquillian", name: "arquillian-bom", version: "1.1.5.Final"
testCompile group: "org.jboss.arquillian.extension", name: "arquillian-drone-bom", version: "2.0.0.Alpha3"
testCompile group: "org.jboss.arquillian.junit", name: "arquillian-junit-container", version: "1.1.5.Final"
testCompile 'org.jboss.arquillian.container:arquillian-glassfish-embedded-3.1:1.0.0.CR3'
testCompile group: "org.jboss.arquillian.graphene", name: "graphene-webdriver", version: "2.1.0.Alpha2"
testCompile group: "org.jboss.shrinkwrap.resolver", name: "shrinkwrap-resolver-gradle-depchain", version: "2.2.0-beta-1"
// testRuntime files(glassfishHome + File.separator + "glassfish" + File.separator + "lib" + File.separator +
// "embedded" + File.separator + "glassfish-embedded-static-shell.jar")
}
test {
// show standard out and standard error of the test JVM(s) on the console
testLogging {
showStandardStreams = true
exceptionFormat = "full"
}
}
task deploy(dependsOn: "war", type: Exec) {
workingDir glassfishHome
commandLine asadmin()
args "deploy", "--force=true", "--name=${moduleName}", "${archivePath}"
// args "deploy", "--force=true", "--debug", "--name=${moduleName}", "${archivePath}"
}
task undeploy(type: Exec) {
workingDir glassfishHome
commandLine asadmin()
args "undeploy", "${moduleName}"
}
task redeployApp(dependsOn: "copyForReload", type: Exec) {
workingDir glassfishHome
commandLine asadmin()
args "redeploy", "--keepstate=true", "--name=${moduleName}", "${archivePath}"
}
task redeploy() {
dependsOn "redeployApp"
}
task reloadClient(dependsOn: "copyForReload", type: Exec) {
workingDir deployedAppDir
commandLine touch()
if (isWindows()) {
// Ref: http://superuser.com/a/764721
args "${deployedAppDir}${File.separator}.reload", "+,,"
} else {
args "${deployedAppDir}${File.separator}.reload"
}
}
task copyForReload(dependsOn: "war", type: Copy) {
from zipTree(file("${archivePath}"))
into file("${deployedAppDir}")
}
task reload() {
dependsOn "reloadClient"
}
sourceSets{
main { compileClasspath += configurations.provided }
itest {
java.srcDir file('src/itest/java')
resources.srcDir file('src/itest/resources')
}
}
task itest(type: Test){
description = "Runs the integration tests for safhrms"
testClassesDir = sourceSets.itest.output.classesDir
classpath = sourceSets.itest.runtimeClasspath
testLogging {
showStandardStreams = true
exceptionFormat = "full"
}
}
//configure findbug plugin to generate report in html instead of xml
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}