-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
172 lines (145 loc) · 6.57 KB
/
build.gradle.kts
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
import org.jetbrains.kotlin.allopen.gradle.AllOpenExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.noarg.gradle.NoArgExtension
plugins {
val kotlinVersion = "1.4.31"
idea
kotlin("jvm") version kotlinVersion
war
id("fish.payara.micro-gradle-plugin") version "1.0.3"
id("org.jetbrains.kotlin.plugin.allopen") version kotlinVersion
id("org.jetbrains.kotlin.plugin.noarg") version kotlinVersion
id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
id("io.spring.dependency-management") version "1.0.11.RELEASE"
jacoco
}
group = "poc"
version = "1.0-SNAPSHOT"
repositories {
jcenter()
maven {
url = uri("https://repo.gradle.org/gradle/libs-releases-local/")
}
maven {
url = uri("https://raw.github.com/payara/Payara_PatchedProjects/master")
}
maven {
url = uri("https://nexus.payara.fish/repository/payara-artifacts")
}
}
val jakartaeeVersion = "8.0.0"
val payaraMicroVersion = "5.2021.2"
val log4j2Version = "2.14.1"
val slf4jVersion = "1.8.0-beta4" // compatible to log4j2
val openTracingApi = "0.33.0" // compatible to microprofile
val junitVersion = "5.8.0-M1"
val junitPlatformVersion = "1.8.0-M1"
val spekVersion = "2.0.15"
val kluentVersion = "1.65"
val arquillianVersion = "1.6.0.Final"
val shrinkwrapVersion = "3.1.4"
val restAssuredVersion = "4.3.3"
val jjwtVersion = "0.9.1"
val microshedVersion = "0.9.1"
val cucumberVersion = "6.10.2"
val awaitilityVersion = "4.0.3"
val payaraMicroJarDir = "$buildDir/payara-micro"
val payaraMicroJarName = "payara-micro.jar"
val payaraMicroJarPath = "$payaraMicroJarDir/$payaraMicroJarName"
val payaraMicroPostBootCommandScript = "$projectDir/configs/post-boot-command.txt"
dependencyManagement {
imports {
mavenBom("fish.payara.api:payara-bom:$payaraMicroVersion")
mavenBom("org.jboss.arquillian:arquillian-bom:$arquillianVersion")
}
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("org.apache.logging.log4j:log4j-slf4j18-impl:$log4j2Version")
implementation("org.slf4j:osgi-over-slf4j:$slf4jVersion")
implementation("org.slf4j:jul-to-slf4j:$slf4jVersion")
implementation("org.slf4j:log4j-over-slf4j:$slf4jVersion")
implementation("org.slf4j:jcl-over-slf4j:$slf4jVersion")
providedCompile("jakarta.platform:jakarta.jakartaee-web-api:$jakartaeeVersion")
providedCompile("org.eclipse.microprofile:microprofile")
// since [email protected], all dependencies are defined in provided scope that I have to include them manually
providedCompile("org.eclipse.microprofile.config:microprofile-config-api")
providedCompile("org.eclipse.microprofile.fault-tolerance:microprofile-fault-tolerance-api")
providedCompile("org.eclipse.microprofile.health:microprofile-health-api")
providedCompile("org.eclipse.microprofile.jwt:microprofile-jwt-auth-api")
providedCompile("org.eclipse.microprofile.metrics:microprofile-metrics-api")
providedCompile("org.eclipse.microprofile.openapi:microprofile-openapi-api")
providedCompile("org.eclipse.microprofile.opentracing:microprofile-opentracing-api")
providedCompile("org.eclipse.microprofile.rest.client:microprofile-rest-client-api")
providedCompile("io.opentracing:opentracing-api:$openTracingApi")
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.junit.platform:junit-platform-engine:$junitPlatformVersion")
testImplementation("org.junit.platform:junit-platform-commons:$junitPlatformVersion")
testImplementation("org.spekframework.spek2:spek-dsl-jvm:$spekVersion")
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:$spekVersion")
testImplementation("org.amshove.kluent:kluent:$kluentVersion")
testImplementation("org.junit.vintage:junit-vintage-engine:$junitVersion")
testImplementation("org.jboss.arquillian.junit:arquillian-junit-container")
testImplementation("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-gradle:$shrinkwrapVersion") {
exclude(module = "gradle-tooling-api")
}
testImplementation("org.gradle:gradle-tooling-api:${gradle.gradleVersion}")
testRuntimeOnly("fish.payara.arquillian:arquillian-payara-micro-managed")
testRuntime("fish.payara.extras:payara-micro")
testImplementation("io.rest-assured:rest-assured:$restAssuredVersion") {
// suspend the warning of "'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-osgi:2.2.10"
exclude(module = "jaxb-osgi")
}
testImplementation("io.jsonwebtoken:jjwt:$jjwtVersion")
testImplementation("fish.payara.api:payara-api")
testImplementation("org.microshed:microshed-testing-payara-micro:$microshedVersion")
testImplementation("org.testcontainers:junit-jupiter:1.15.2") /* include it for hot fix */
testImplementation("io.cucumber:cucumber-java8:$cucumberVersion")
testImplementation("io.cucumber:cucumber-junit-platform-engine:$cucumberVersion")
testImplementation("org.awaitility:awaitility:$awaitilityVersion")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.war {
archiveFileName.set("${project.name}.war")
}
tasks.withType<Test> {
dependsOn("copyPayaraMicro")
environment("MICRO_JAR", "$payaraMicroJarDir/$payaraMicroJarName")
environment("EXTRA_MICRO_OPTIONS", "--postbootcommandfile $payaraMicroPostBootCommandScript")
useJUnitPlatform {
includeEngines("spek2", "junit-jupiter", "junit-vintage", "cucumber")
}
finalizedBy("jacocoTestReport")
}
task<Copy>("copyPayaraMicro") {
from(configurations.testRuntime.get().files { it.name == "payara-micro" })
into(payaraMicroJarDir)
rename { payaraMicroJarName }
}
/**
* Check the guide in https://docs.payara.fish/documentation/ecosystem/gradle-plugin.html
*/
payaraMicro {
payaraVersion = payaraMicroVersion
deployWar = true
commandLineOptions = mapOf(
"postbootcommandfile" to payaraMicroPostBootCommandScript
)
}
jacoco {
toolVersion = "0.8.5"
}
configure<AllOpenExtension> {
annotation("javax.enterprise.context.RequestScoped")
annotation("javax.enterprise.context.ApplicationScoped")
}
configure<NoArgExtension> {
annotation("javax.enterprise.context.RequestScoped")
annotation("javax.enterprise.context.ApplicationScoped")
annotation("poc.microprofile.annotation.DeserializableModel")
}