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 14
/
Copy pathbuild.gradle
112 lines (92 loc) · 3.15 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
apply plugin: 'war'
apply plugin: 'liberty'
group = 'liberty.gradle'
version = '1'
description = "Java Persistence API (JPA) Sample"
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()
}
ext {
// Liberty server properties
wlpServerName = 'LibertyProjectServer'
serverDirectory = "${project.buildDir}/wlp/usr/servers/${wlpServerName}"
testServerHttpPort = 9080
testServerHttpsPort = 9443
warContext = 'jpaApp'
}
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}"]
name = 'LibertyProjectServer'
apps = [war]
features {
name = ['servlet-3.1', 'jdbc-4.1', 'jpa-2.0', 'localConnector-1.0']
acceptLicense = true
}
}
}
configurations{
derby { transitive = true }
}
dependencies {
providedCompile group: 'javax.persistence', name: 'persistence-api', version:'1.0.2'
providedCompile group: 'javax.transaction', name: 'javax.transaction-api', version:'1.2'
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
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'
derby group: 'org.apache.derby', name: 'derby', version: '10.13.1.1'
libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'wlp-kernel', version: '17.0.0.2'
}
task copyDerby {
doLast {
copy {
from configurations.derby
into "$buildDir/wlp/usr/shared/resources"
include '*.jar'
}
}
}
test {
println 'inside the 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'"
}
}
check.dependsOn 'integrationTest'
libertyCreate.finalizedBy 'copyDerby', 'installFeature'
integrationTest.dependsOn 'libertyStart', 'testClasses'
integrationTest.finalizedBy 'libertyStop'
libertyStart.finalizedBy 'printMessageAboutRunningServer'