-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
80 lines (65 loc) · 2.08 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
import com.bmuschko.gradle.docker.tasks.image.*
import org.springframework.boot.gradle.tasks.bundling.BootJar
import java.util.Collections
import java.nio.file.Files
import java.nio.file.Paths
plugins {
java
jacoco
id("org.springframework.boot") version "2.1.1.RELEASE"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
id("com.bmuschko.docker-remote-api") version "4.1.0"
}
jacoco.toolVersion = "0.8.2"
group = "com.lamtev"
version = "1.0.RELEASE"
val serviceName = "xml-against-xsd-validation-service"
repositories {
jcenter()
}
dependencies {
compile("com.intellij:annotations:12.0")
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "junit")
}
testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.2")
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_11
}
val jacocoReport = tasks.withType<JacocoReport> {
reports {
xml.isEnabled = true
html.isEnabled = true
}
}
tasks.withType<Test> {
useJUnitPlatform()
finalizedBy(jacocoReport)
}
val bootJar = tasks.withType<BootJar> {
baseName = serviceName
version = project.version as String
mainClassName = "com.lamtev.xml_against_xsd_validation_service.ServiceLauncher"
}
tasks.create("buildDockerImage", type = DockerBuildImage::class) {
inputDir.set(file("."))
tag.set("lamtev/xml-against-xsd-validation-service:latest")
}
tasks.create("pushDockerImage", type = DockerPushImage::class) {
tag.set("lamtev/xml-against-xsd-validation-service:latest")
}
tasks.create("runService", type = JavaExec::class) {
main = "-jar"
val jarName = "$serviceName-$version.jar"
args = Collections.singletonList(
when {
Files.exists(Paths.get(jarName)) -> jarName
Files.exists(Paths.get("build/libs/$jarName")) -> "build/libs/$jarName"
else -> ""
}
)
dependsOn(bootJar)
}