-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
167 lines (141 loc) · 5.43 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
plugins {
id 'application'
id 'checkstyle'
id 'pmd'
id 'jacoco'
id 'io.spring.dependency-management' version '1.0.4.RELEASE'
id 'org.springframework.boot' version '1.5.10.RELEASE'
id 'org.owasp.dependencycheck' version '3.1.0'
id 'com.github.ben-manes.versions' version '0.17.0'
id 'org.sonarqube' version '2.5'
id 'net.ltgt.apt' version '0.13'
}
group = 'uk.gov.hmcts.reform'
version = '0.0.1'
sourceCompatibility = 1.8
targetCompatibility = 1.8
checkstyle {
maxWarnings = 0
toolVersion = '8.7'
configDir = new File(rootDir, 'config/checkstyle')
}
// https://github.com/gradle/gradle/pull/3901 - at the time it is planed for Gradle 4.7RC1
// make build fail on Checkstyle issues (https://github.com/gradle/gradle/issues/881)
tasks.withType(Checkstyle).each { checkstyleTask ->
checkstyleTask.doLast {
reports.all { report ->
def outputFile = report.destination
if (outputFile.exists() && outputFile.text.contains("<error ")) {
throw new GradleException("There were checkstyle warnings! For more info check $outputFile")
}
}
}
}
// https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html
dependencyCheck {
// Specifies if the build should be failed if a CVSS score above a specified level is identified.
// range of 0-10 fails the build, anything greater and it doesn't fail the build
failBuildOnCVSS = System.getProperty('dependencyCheck.failBuild') == 'true' ? 0 : 11
suppressionFile = 'dependency-check-suppressions.xml'
}
mainClassName = 'uk.gov.hmcts.reform.finrem.FinancialRemedyApplication'
repositories {
jcenter()
maven {
url "https://dl.bintray.com/hmcts/hmcts-maven"
}
}
sourceSets {
test {
java.srcDir 'src/test/java'
}
functional {
java.srcDir 'src/test/functional/java'
resources.srcDir 'src/test/resources'
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
configurations {
functionalCompile.extendsFrom testCompile
functionalRuntime.extendsFrom testRuntime
}
pmd {
toolVersion = "5.8.1"
ignoreFailures = true
sourceSets = [sourceSets.main, sourceSets.test]
reportsDir = file("$project.buildDir/reports/pmd")
ruleSetFiles = files("config/pmd/ruleset.xml")
}
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')
}
}
}
}
jacocoTestReport {
executionData(test)
reports {
xml.enabled = true
csv.enabled = false
xml.destination file("${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
def springBootVersion = plugins.getPlugin('org.springframework.boot').class.package.implementationVersion
def springfoxSwagger = '2.7.0'
def javaLoggingVersion = '1.6.1'
def versions = [
springfoxSwagger: '2.7.0',
javaLoggingVersion: '1.6.1'
]
bootRun {
systemProperty 'server.port', '8085'
}
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: springBootVersion
compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: springBootVersion
compile group: 'io.springfox', name: 'springfox-swagger2', version: springfoxSwagger
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: springfoxSwagger
compile group: 'uk.gov.hmcts.reform', name: 'java-logging-spring', version: javaLoggingVersion
compile group: 'uk.gov.hmcts.reform', name: 'java-logging-httpcomponents', version: javaLoggingVersion
compile group: 'uk.gov.hmcts.reform', name: 'java-logging-appinsights', version: javaLoggingVersion
compile group: 'uk.gov.hmcts.reform', name: 'http-proxy-spring-boot-autoconfigure', version: '1.1.0'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-hystrix', version: '1.4.0.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-hystrix-dashboard', version: '1.4.0.RELEASE'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion
testCompile group: 'io.rest-assured', name: 'rest-assured', version: '3.0.6'
}
jar {
archiveName 'finrem-backend.jar'
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': project.version
}
}
task smoke(type: Test, description: 'Runs the smoke tests.', group: 'Verification') {
testClassesDirs = sourceSets.functional.output.classesDirs
classpath = sourceSets.functional.runtimeClasspath
useJUnit {
includeCategories 'uk.gov.hmcts.reform.finrem.functional.SmokeTest'
}
}
task functional(type: Test, description: 'Runs the functional tests.', group: 'Verification') {
testClassesDirs = sourceSets.functional.output.classesDirs
classpath = sourceSets.functional.runtimeClasspath
}
sonarqube {
properties {
property "sonar.projectName", "Financial Remedy"
property "sonar.projectKey", "FINREM"
property "sonar.jacoco.reportPath", "${project.buildDir}/jacoco/test.exec"
property "sonar.jacoco.itReportPath", "${project.buildDir}/jacoco/functional.exec"
property "sonar.exclusions", "**/finrem/models/**, **/finrem/FinancialRemedyApplication.java"
}
}