/
build.gradle
175 lines (144 loc) · 5.19 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
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
173
174
175
buildscript {
ext {
kotlinVersion = '1.6.21' // 1.7.0 skaper trøbbel for mockk: https://github.com/mockk/mockk/issues/832 - som igjen feiler tester i prefill-appen
springFrameworkVersion = '5.3.21'
springBootVersion = '2.7.1'
jacksonModuleKotlinVersion = '2.13.3'
eessiMetricsVersion = '0.5.4'
eessiEpLoggingVersion = '1.0.31'
mockkVersion = '1.12.4'
tokenSupportVersion = '1.3.19'
}
repositories {
mavenCentral()
}
}
plugins {
id("java-library")
id("maven-publish")
id("org.jetbrains.kotlin.jvm") version "${kotlinVersion}"
id("net.researchgate.release") version "3.0.0"
id("org.jetbrains.kotlin.plugin.spring") version "${kotlinVersion}"
id("com.adarshr.test-logger") version "3.2.0"
id("com.github.ben-manes.versions") version "0.42.0"
id("se.patrikerdes.use-latest-versions") version "0.2.18"
id("org.owasp.dependencycheck") version "7.1.1"
id("com.vanniktech.dependency.graph.generator") version "0.8.0"
id "org.sonarqube" version "3.4.0.2513"
id 'jacoco'
}
group = "no.nav.eessi.pensjon"
java {
withJavadocJar()
withSourcesJar()
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "17"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "17"
}
}
// https://docs.gradle.org/current/userguide/jacoco_plugin.html
jacoco {
toolVersion = "0.8.8"
}
jacocoTestReport {
reports {
xml.enabled true
}
}
tasks.sonarqube.dependsOn tasks["jacocoTestReport"]
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom:${kotlinVersion}"))
implementation("org.jetbrains.kotlin:kotlin-reflect")
// Logging
implementation('net.logstash.logback:logstash-logback-encoder:7.2') {
exclude module: "commons-logging"
}
implementation("no.nav.eessi.pensjon:ep-metrics:$eessiMetricsVersion")
implementation("no.nav.eessi.pensjon:ep-logging:$eessiEpLoggingVersion")
// Spring-boot BOM-fil spesifiserer versjoner for Spring Boot-avhengigheter
implementation(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
implementation("org.springframework.boot:spring-boot-starter-web") {
exclude module : "tomcat-embed-core"
}
// Spring Framework BOM-fil overstyrer så vi får siste patch-versjon av Spring Framework
implementation(platform("org.springframework:spring-framework-bom:$springFrameworkVersion"))
implementation("org.springframework:spring-web")
//Jackson json
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlinVersion")
implementation("javax.servlet:javax.servlet-api:4.0.1")
testImplementation(platform("org.junit:junit-bom:5.8.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.springframework:spring-test")
testImplementation("io.mockk:mockk:$mockkVersion")
//Auth
implementation("no.nav.security:token-client-spring:${tokenSupportVersion}")
implementation("no.nav.security:token-validation-spring:${tokenSupportVersion}")
implementation("no.nav.security:token-validation-jaxrs:${tokenSupportVersion}")
implementation("no.nav.security:token-validation-test-support:${tokenSupportVersion}")
configurations { all*.exclude group: 'commons-logging', module: 'commons-logging' }
}
test {
useJUnitPlatform()
failFast = true
testLogging {
exceptionFormat "full"
events "started", "skipped", "passed", "failed"
showStandardStreams true
}
}
// https://github.com/researchgate/gradle-release
release {
newVersionCommitMessage = "[Release Plugin] - next version commit: "
tagTemplate = "release-\${version}"
git {
requireBranch.set('master')
}
}
// https://help.github.com/en/actions/language-and-framework-guides/publishing-java-packages-with-gradle#publishing-packages-to-github-packages
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/navikt/ep-personoppslag"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
repositories {
mavenCentral()
["ep-metrics", "ep-logging"].each { repo ->
String token = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.key")
if (!token) throw new NullPointerException("Missing token, you have to set GITHUB_TOKEN or gpr.key, see README")
maven {
url = uri("https://maven.pkg.github.com/navikt/$repo")
credentials {
username = "token"
password = token
}
}
}
}
/* https://github.com/ben-manes/gradle-versions-plugin */
dependencyUpdates {
rejectVersionIf {
['alpha', 'beta', 'b', 'rc', 'cr', 'm', 'preview', 'pr']
.any { qualifier -> it.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/}
}
revision = 'release'
}