-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
214 lines (185 loc) · 7.49 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
/**
* Copyright 2021 Karlsruhe Institute of Technology.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id "io.freefair.lombok" version "8.12"
id "io.freefair.maven-publish-java" version "8.12"
id "io.spring.dependency-management" version "1.1.7"
//id "com.github.kt3k.coveralls" version "2.8.1"
id "org.owasp.dependencycheck" version "12.0.1"
id "org.asciidoctor.jvm.convert" version "4.0.4"
//id "org.ajoberstar.grgit" version "2.0.1"
id "java"
id "jacoco"
// plugins for release and publishing to maven repo
id "signing"
id "net.researchgate.release" version "3.1.0"
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id 'maven-publish'
}
ext {
// versions of dependencies
springBootVersion = '3.4.2'
springDocVersion = '2.8.3'
javersVersion = '7.7.0'
}
description = "Core module for data repositories based on metadata model of datacite."
group = 'edu.kit.datamanager'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
jar {
archiveBaseName = 'repo-core'
archiveVersion = System.getenv('version')
}
println "Building ${name} version: ${version}"
println "Running gradle version: $gradle.gradleVersion"
println "JDK version: ${JavaVersion.current()}"
println "Spring Boot version: ${springBootVersion}"
repositories {
mavenLocal()
mavenCentral()
}
configurations {
all*.exclude module : 'spring-boot-starter-logging'
}
if (project.hasProperty('release')) {
println 'Using \'release\' profile for building ' + project.getName()
apply from: 'gradle/profile-deploy.gradle'
}
dependencies {
// Spring
implementation 'org.springframework:spring-messaging:6.2.2'
// Spring Boot
implementation "org.springframework.boot:spring-boot-starter-data-rest"
implementation "org.springframework.boot:spring-boot-starter-amqp"
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "org.springframework.boot:spring-boot-starter-security"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation 'org.springframework.data:spring-data-elasticsearch:5.4.2'
// springdoc
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springDocVersion}"
implementation "org.springdoc:springdoc-openapi-starter-common:${springDocVersion}"
implementation "org.springdoc:springdoc-openapi-starter-webmvc-api:${springDocVersion}"
// apache
implementation "commons-configuration:commons-configuration:1.10"
implementation "commons-io:commons-io:2.18.0"
implementation "org.apache.commons:commons-collections4:4.4"
// includes commons-lang3
implementation "org.apache.commons:commons-text:1.13.0"
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation "org.apache.tika:tika-core:3.0.0"
// javers
implementation "org.javers:javers-spring-boot-starter-sql:${javersVersion}"
implementation "com.google.code.gson:gson:2.11.0"
// Database
implementation "com.h2database:h2:2.3.232"
implementation "org.postgresql:postgresql:42.7.5"
// XML
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.18.2"
implementation "com.fasterxml.jackson.module:jackson-module-afterburner:2.18.2"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:2.18.2"
//implementation "com.monitorjbl:spring-json-view:1.0.1"
implementation "de.codecentric:spring-boot-admin-starter-client:3.4.1"
// log4j core
implementation "org.apache.logging.log4j:log4j-core"
implementation "ch.qos.logback:logback-classic"
implementation "edu.kit.datamanager:service-base:1.3.3"
implementation "com.github.java-json-tools:json-patch:1.13"
implementation "com.github.dozermapper:dozer-core:7.0.0"
testImplementation "junit:junit:4.13.2"
testImplementation "org.springframework:spring-test"
// boot starter
testImplementation 'org.springframework.boot:spring-boot-starter-validation'
testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3'
testImplementation "org.springframework.security:spring-security-test"
//Java 11 Support
testImplementation "org.mockito:mockito-inline:5.2.0"
}
def signingTasks = tasks.withType(Sign)
tasks.withType(AbstractPublishToMaven).configureEach{
mustRunAfter(signingTasks)
}
test {
println 'Execute all tests...'
include '**/*'
// Allow access to internal methods used by powerMockito
// Will fail with Java17
if (!JavaVersion.current().isJava8()) {
println 'Allow access to private methods...'
jvmArgs '--illegal-access=permit'
}
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) {
println 'Allow access to private methods of package java.util.stream...'
jvmArgs '--add-opens=java.base/java.util.stream=ALL-UNNAMED'
}
testLogging {
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
jacoco {
toolVersion = "0.8.12"
}
tasks.withType(Test) {
testLogging {
events 'started', 'passed'
}
}
jacocoTestReport {
dependsOn test
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: [\
//pure entity package currently not needed
'org/datacite/**', \
'org/purl/**', \
//performance tests
'edu/kit/datamanager/perf/**', \
//remove AuthenticationHelper tests due to mocking -> code coverage cannot be determined
//'edu/kit/datamanager/util/AuthenticationHelper*',
//deprecated stuff
'edu/kit/datamanager/util/DCTransformationHelper*',
'edu/kit/datamanager/dao/ByExampleSpecification*',
'edu/kit/datamanager/controller/hateoas/**',
//exceptions
'edu/kit/datamanager/exceptions/**',
'edu/kit/datamanager/service/impl/RabbitMQMessagingService*',
'edu/kit/datamanager/configuration/**',
'edu/kit/datamanager/service/IGenericService*'
])
}))
}
}
dependencyManagement {
imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}") }
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
jar {
dependsOn jacocoTestReport
}