-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
218 lines (191 loc) · 8.4 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
plugins {
// Spring boot & dependency management:
// https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/
id 'org.springframework.boot' version '3.3.5'
// https://docs.spring.io/dependency-management-plugin/docs/current-SNAPSHOT/reference/html/
id "io.spring.dependency-management" version "1.1.7"
// Lombok generates getter and setter and more. https://projectlombok.org/
// check for new versions here: https://plugins.gradle.org/plugin/io.freefair.lombok
id "io.freefair.lombok" version "8.11"
// Release tagging with `./gradlew release`
// Check for new versions here: https://plugins.gradle.org/plugin/net.researchgate.release
// Usage: https://github.com/researchgate/gradle-release
id 'net.researchgate.release' version '3.1.0'
id 'java'
// for comfortable run command with arguments
id 'application'
// test and docs dependencies
id 'jacoco'
// Adds coveralls task for CI to send results to the coveralls service.
id "com.github.kt3k.coveralls" version "2.12.2"
id "org.owasp.dependencycheck" version "11.1.1"
// include build and git information via Spring Actuator
id "com.gorylenko.gradle-git-properties" version "2.4.2"
}
lombok {
// check here for new versions: https://projectlombok.org/download
version = '1.18.30'
}
jacoco {
// check here for new versions: https://www.jacoco.org/jacoco/
toolVersion = "0.8.11"
}
description = "A gateway to manage PIDs containing profiles and typed attributes."
group = 'edu.kit.datamanager'
println "Running gradle version: $gradle.gradleVersion"
println "Building ${name} version: ${version}"
println "JDK version: ${JavaVersion.current()}"
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}
ext {
springDocVersion = '2.6.0'
}
dependencies {
// Due to the spring boot gradle plugin, we can omit versions in org.springframework.*
// dependencies. It will automatically choose the fitting ones.
implementation("edu.kit.datamanager:service-base:1.3.2")
implementation("edu.kit.datamanager:repo-core:1.2.3")
// com.google.common, LoadingCache
implementation("com.google.guava:guava:33.4.0-jre")
// spring core, e.g. @EnableJpaRepositories
implementation "org.springframework:spring-core"
// spring security: required for security filters, firewall, ...
implementation "org.springframework.security:spring-security-web"
implementation "org.springframework.security:spring-security-config"
// spring boot
// needed by spring boot to start tomcat web server
implementation "org.springframework.boot:spring-boot-starter-web"
// ??? (builds without it, but does not work without it)
implementation "org.springframework.boot:spring-boot-starter-validation"
// required for messaging
implementation "org.springframework.boot:spring-boot-starter-actuator"
// @EnableJPARepositories, JTA related things which are needed at runtime
implementation "jakarta.transaction:jakarta.transaction-api:2.0.1"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
// springdoc / openapi / swagger
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springDocVersion}"
implementation "org.springdoc:springdoc-openapi-starter-webmvc-api:${springDocVersion}"
// spring + elasticsearch communication
implementation "org.springframework.data:spring-data-elasticsearch"
// More flexibility when (de-)serializing json:
//implementation("com.monitorjbl:spring-json-view:1.1.0")
implementation("com.github.everit-org.json-schema:org.everit.json.schema:1.14.4")
implementation('org.apache.httpcomponents:httpclient:4.5.14')
implementation('org.apache.httpcomponents:httpclient-cache:4.5.14')
implementation("net.handle:handle-client:9.3.1")
testImplementation(platform('org.junit:junit-bom:5.11.4'))
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation('org.junit.jupiter:junit-jupiter-params')
testImplementation("org.springframework:spring-test")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
testImplementation("org.springframework.security:spring-security-test")
testImplementation("com.jayway.jsonpath:json-path:2.9.0")
}
application {
mainClass = 'edu.kit.datamanager.pit.Application'
}
// Makes executable jar file.
// Available function available through Spring Boot Gradle Plugin.
bootJar {
manifest {
// "Looks in various places for a properties file to extract loader settings,
// defaulting to loader.properties either on the current classpath or in the
// current working directory."
// Docs:
// https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable.configuring.main-class
// https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/loader/PropertiesLauncher.html
attributes 'Main-Class': 'org.springframework.boot.loader.launch.PropertiesLauncher'
}
// Make the Typed PID Maker executable without `java -jar`
// by adding a launch script into the jar file.
// Works only on unix platforms.
// https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable.configuring.launch-script
launchScript()
}
// we do not need the normal "plain" jar, as we use bootjar.
jar {
enabled = false
}
compileJava {
// Display more warnings when compiling.
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
java {
toolchain {
// "By default, Gradle uses the same Java version for running
// Gradle itself and building JVM projects."
// We can enforce a specific version here. By default, we do not do this
// to enable the CI to test with different JDKs.
// https://docs.gradle.org/current/userguide/toolchains.html#toolchains
//languageVersion = JavaLanguageVersion.of(jdkVersion)
}
}
test {
finalizedBy jacocoTestReport
environment "spring.config.location", "classpath:/test/"
// for junit5
useJUnitPlatform()
if (System.getProperty("profile") == "verbose") {
println "Tests will have verbose output"
testLogging {
// tests are never "up-to-date", always print everything
outputs.upToDateWhen {false}
// show stdio when tests are running
showStandardStreams = true
// for junit5
events "passed", "skipped", "failed"
}
} else {
println "Test will have compact output"
testLogging {
// for junit5
events "passed", "skipped", "failed"
}
}
}
javadoc {
// include doc-files folder in javadoc
doLast {
copy {
from "src/main/javadoc"
into "$rootProject.layout.buildDirectory/docs/javadoc"
}
}
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
afterEvaluate {
//exclude some classes/package from code coverage report
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [\
'edu/kit/datamanager/pit/configuration/**', \
'edu/kit/datamanager/pit/web/converter/**', \
'edu/kit/datamanager/pit/web/ExtendedErrorAttributes**', \
'edu/kit/datamanager/pit/web/UncontrolledExceptionHandler**', \
'edu/kit/datamanager/pit/common/**', \
'edu/kit/datamanager/pit/Application*'
])
}))
}
}
springBoot {
buildInfo()
}
release {
// define tag pattern (tags have to start with 'v')
tagTemplate = 'v${version}'
git {
requireBranch.set("master")
}
}
tasks.withType(Jar).configureEach { duplicatesStrategy(DuplicatesStrategy.EXCLUDE) }
tasks.withType(Tar).configureEach { duplicatesStrategy(DuplicatesStrategy.EXCLUDE) }
tasks.withType(Copy).configureEach { duplicatesStrategy(DuplicatesStrategy.EXCLUDE) }
tasks.withType(Zip).configureEach { duplicatesStrategy(DuplicatesStrategy.EXCLUDE) }