-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
229 lines (189 loc) · 6.07 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
219
220
221
222
223
224
225
226
227
228
229
plugins {
id 'checkstyle'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'com.github.ben-manes.versions' version '0.50.0'
id 'com.jfrog.bintray' version '1.8.5'
id 'java-library'
id 'maven'
id 'maven-publish'
id 'net.ltgt.apt' version '0.21'
}
// This will pick up the version number from release tag
def buildNumber = System.getenv("RELEASE_VERSION")?.replace("refs/tags/", "") ?: "DEV-SNAPSHOT"
group 'uk.gov.hmcts.reform'
version buildNumber
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
def springBootVersion = '2.5.4'
checkstyle {
maxWarnings = 0
toolVersion = '8.29'
// need to set configDir to rootDir otherwise submodule will use submodule/config/checkstyle
configDir = new File(rootDir, 'config/checkstyle')
}
sourceCompatibility = 11
compileJava {
options.compilerArgs << '-parameters' << '-Xlint:deprecation'
}
compileTestJava {
options.compilerArgs << '-Xlint:deprecation'
}
repositories {
mavenLocal()
jcenter()
maven {
url 'https://jitpack.io'
}
}
jar {
manifest {
attributes 'Implementation-Title': project.name, 'Implementation-Version': project.version
}
}
task printVersion {
doLast {
print project.version
}
}
def gitRepo = "https://github.com/hmcts/payments-java-client"
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
test {
useJUnitPlatform()
}
ext {
lombokVersion = '1.18.30'
springCloudVersion = 'Hoxton.SR2'
feignVersion = '12.5'
}
def versions = [
logback : '1.2.3',
springBoot : springBootVersion,
reformJavaLogging: '5.0.1',
junitJupiter : '5.10.1'
]
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
sourceSets {
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir('src/functionalTest/java')
}
resources {
srcDir('src/functionalTest/resources')
}
}
}
configurations {
functionalTestImplementation.extendsFrom testImplementation
functionalTestRuntimeOnly.extendsFrom testRuntimeOnly
}
task functionalTest(type: Test) {
description = 'Runs functional tests.'
group = 'verification'
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
include "uk/gov/hmcts/reform/payments/client/functional/**"
useJUnitPlatform()
}
dependencies {
api group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign'
api group: 'io.github.openfeign', name: 'feign-jackson', version: feignVersion
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombokVersion
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
compile group: 'ch.qos.logback', name: 'logback-classic', version: versions.logback
compile group: 'ch.qos.logback', name: 'logback-core', version: versions.logback
compile group: 'uk.gov.hmcts.reform', name: 'java-logging', version: versions.reformJavaLogging
compile group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: versions.junitJupiter
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation 'org.mockito:mockito-junit-jupiter:5.8.0'
testImplementation 'ru.lanwen.wiremock:wiremock-junit5:1.3.1'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '2.35.1'
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-contract-wiremock'
functionalTestImplementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0'
functionalTestCompileOnly group: 'org.projectlombok', name: 'lombok', version: lombokVersion
functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
}
def pomConfig = {
licenses {
license {
name "MIT License"
url "http://www.opensource.org/licenses/mit-license.php"
distribution "repo"
}
}
scm {
url "https://github.com/hmcts/payments-java-client"
}
}
publishing {
publications {
Main(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId 'payments-client'
version project.version
pom.withXml {
def root = asNode()
root.appendNode('description', 'Client library for communicating with payments api')
root.appendNode('name', 'Payments client')
root.appendNode('url', gitRepo)
root.children().last() + pomConfig
}
}
}
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['Main']
publish = true
pkg {
repo = 'hmcts-maven'
name = 'payments-client'
userOrg = 'hmcts'
licenses = ['MIT']
vcsUrl = gitRepo
version {
name = project.version
}
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
bootJar {
enabled = false
}
jar {
enabled = true
}