-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
152 lines (127 loc) · 4 KB
/
build.gradle
File metadata and controls
152 lines (127 loc) · 4 KB
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
plugins {
id 'java-library'
id 'uk.gov.hmcts.java' version '0.12.68'
id 'checkstyle'
id 'jacoco'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.owasp.dependencycheck' version '12.2.0'
id 'com.github.ben-manes.versions' version '0.53.0'
id 'org.sonarqube' version '7.2.3.7755'
id 'io.freefair.lombok' version '9.2.0'
id 'maven-publish'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "AzureArtifacts"
url = uri("https://pkgs.dev.azure.com/hmcts/Artifacts/_packaging/hmcts-lib/maven/v1")
credentials {
username = System.getenv("AZURE_DEVOPS_ARTIFACT_USERNAME")
password = System.getenv("AZURE_DEVOPS_ARTIFACT_TOKEN")
}
}
}
}
def buildNumber = System.getenv("RELEASE_VERSION")?: "DEV-SNAPSHOT"
group = 'com.github.hmcts'
version = buildNumber
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
// https://github.com/gradle/gradle/issues/16791
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
test {
failFast = true
}
checkstyle {
toolVersion = '13.3.0'
}
jacocoTestReport {
executionData(test)
reports {
xml.required = true
csv.required = false
xml.outputLocation.set(layout.buildDirectory.file("reports/jacoco/test/jacocoTestReport.xml"))
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
sonarqube {
properties {
property "sonar.projectName", "PIP Data Models"
property "sonar.projectKey", "pip-data-models"
property "sonar.exclusions", sonarExclusions.join(', ')
}
}
configurations {
all {
exclude group: 'commons-logging', module: 'commons-logging'
}
}
// before committing a change, make sure task still works
dependencyUpdates {
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+$/
return !stableKeyword && !(version ==~ regex)
}
rejectVersionIf { selection -> // <---- notice how the closure argument is named
return isNonStable(selection.candidate.version) && !isNonStable(selection.currentVersion)
}
}
// https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html
dependencyCheck {
suppressionFile = 'config/owasp/suppressions.xml'
skipTestGroups = false
}
repositories {
mavenLocal()
mavenCentral()
maven {
url = 'https://pkgs.dev.azure.com/hmcts/Artifacts/_packaging/hmcts-lib/maven/v1'
}
}
ext {
log4JVersion = '2.25.3'
spring = '3.5.12'
}
dependencies {
implementation "org.springframework.boot:spring-boot-starter-json:${spring}"
implementation "org.springframework.boot:spring-boot-starter-data-jpa:${spring}"
implementation "org.springframework.boot:spring-boot-starter-oauth2-client:${spring}"
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.2"
implementation "org.apache.logging.log4j:log4j-api:${log4JVersion}"
implementation "org.apache.logging.log4j:log4j-to-slf4j:${log4JVersion}"
implementation 'org.eclipse.angus:angus-activation:2.0.3'
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.1"
implementation "com.opencsv:opencsv:5.12.0"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
testImplementation "org.springframework.boot:spring-boot-starter-test:${spring}"
testImplementation "com.github.hmcts:fortify-client:1.4.10:all"
implementation 'org.apache.commons:commons-lang3:3.20.0'
}
tasks.register('fortifyScan', JavaExec) {
mainClass = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}