-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
105 lines (88 loc) · 3.01 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
plugins {
id 'org.springframework.boot' version '2.1.7.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id 'org.unbroken-dome.test-sets' version '2.2.1'
id 'com.bmuschko.docker-spring-boot-application' version '6.1.1'
id 'jacoco'
id "com.diffplug.gradle.spotless" version "3.27.1"
}
group = 'lv.iljapavlovs'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.amqp:spring-rabbit'
compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
implementation 'org.zalando:logbook-spring-boot-starter:1.13.0'
implementation 'org.jsoup:jsoup:1.12.1'
// combines all needed junit5 dependencies
testImplementation('org.junit.jupiter:junit-jupiter:5.5.2')
// Mockito implementation for JUnit5 extensions
testImplementation('org.mockito:mockito-junit-jupiter:2.23.4')
testImplementation('com.github.tomakehurst:wiremock:2.25.1')
testImplementation 'io.rest-assured:rest-assured:4.1.2'
// need to add these due to https://stackoverflow.com/questions/44993615/java-lang-noclassdeffounderror-io-restassured-mapper-factory-gsonobjectmapperfa#answer-56556257
testImplementation 'io.rest-assured:json-path:4.1.2'
testImplementation 'io.rest-assured:xml-path:4.1.2'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.2.2'
}
//https://github.com/diffplug/spotless/tree/master/plugin-gradle
//spotless {
// java {
// googleJavaFormat()
// removeUnusedImports() // removes any unused imports
// }
//}
test {
testLogging {
events "passed", "skipped", "failed"
}
}
// Make all tests use JUnit 5
tasks.withType(Test) {
useJUnitPlatform()
}
testSets {
integrationTest
}
integrationTest {
testLogging {
events "passed", "skipped", "failed"
}
}
check.dependsOn integrationTest
sourceSets {
integrationTest {
resources {
srcDirs = ['src/integrationTest/resources']
}
}
}
docker {
springBootApplication {
baseImage = 'openjdk:8-jdk-alpine'
ports = [8080, 8080]
images = ['country-phone:0.0.1-SNAPSHOT', 'country-phone:latest']
jvmArgs = ['-Dspring.profiles.active=local']
}
}
jacocoTestReport {
doFirst {
// The JaCoCo plugin adds a JacocoTaskExtension extension to all tasks of type Test.
// Use task state to include or not task execution data
// https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskState.html
executionData(tasks.withType(Test).findAll { it.state.executed })
}
reports {
xml.enabled true
xml.destination(file("${jacoco.reportsDir}/all-tests/jacocoAllTestReport.xml"))
html.enabled true
html.destination(file("${jacoco.reportsDir}/all-tests/html"))
}
}