This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
107 lines (91 loc) · 2.87 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
apply plugin: 'war'
apply plugin: 'liberty'
group = 'liberty.samples'
version = '1'
description = "Liberty JDBC Gradle example"
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.6.3'
}
}
repositories {
mavenCentral()
}
configurations{
derby { transitive = false }
}
dependencies {
testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'org.apache.cxf', name: 'cxf-rt-rs-client', version:'3.1.1'
testCompile group: 'org.glassfish', name: 'javax.json', version:'1.0.4'
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
derby group: 'org.apache.derby', name: 'derby', version: '10.13.1.1'
libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-webProfile7', version: '17.0.0.2'
}
ext {
testServerHttpPort = 9080
testServerHttpsPort = 9443
warContext = 'JDBCApp'
packagingType = 'usr'
}
war {
archiveName = baseName + '.' + extension
}
liberty {
server {
configFile = file('src/main/liberty/config/server.xml')
bootstrapProperties = ['default.http.port': testServerHttpPort,
'default.https.port': testServerHttpsPort,
'appContext': warContext,
'appLocation': war.archiveName]
}
packageLiberty {
include = packagingType
}
}
task copyDerby {
doLast {
copy {
from configurations.derby
into "$buildDir/wlp/usr/shared/resources"
include '*.jar'
}
}
}
test {
println 'inside the unit test block'
reports.html.destination = file("$buildDir/reports/unit")
reports.junitXml.destination = file("$buildDir/test-results/unit")
exclude '**/it/**'
}
task integrationTest(type: Test) {
group 'Verification'
description 'Runs the integration tests.'
reports.html.destination = file("$buildDir/reports/it")
reports.junitXml.destination = file("$buildDir/test-results/it")
include '**/it/**'
exclude '**/unit/**'
systemProperties = ['liberty.test.port': testServerHttpPort, 'war.context': warContext]
}
task printMessageAboutRunningServer {
doLast {
println "The server is now running at http://localhost:${testServerHttpPort}/${warContext}"
println "To stop the server run 'gradle libertyStop'"
}
}
clean.dependsOn 'libertyStop'
check.dependsOn 'integrationTest'
installApps.dependsOn 'war'
libertyStart.dependsOn 'copyDerby', 'installApps'
copyDerby.dependsOn 'libertyCreate'
integrationTest.dependsOn 'libertyStart', 'testClasses'
integrationTest.finalizedBy 'libertyStop'
libertyStart.finalizedBy 'printMessageAboutRunningServer'