Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
299 lines (288 loc) · 12.5 KB
/
Copy pathbuild.gradle
File metadata and controls
299 lines (288 loc) · 12.5 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
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.4'
id 'io.spring.dependency-management' version '1.1.6'
id 'idea'
id "org.springdoc.openapi-gradle-plugin" version "1.9.0"
id 'eclipse'
id 'checkstyle'
id 'com.diffplug.spotless' version '6.19.0'
id 'net.ltgt.errorprone' version '3.1.0'
}
group = 'org.mifos'
version = '2.0.0.mifos-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
repositories {
mavenCentral()
maven { url "https://repo.spring.io/libs-release" }
maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }
maven { url "https://mifos.jfrog.io/artifactory/phee-gradle-local" }
maven { url "https://mifos.jfrog.io/artifactory/mifosx-gradle-local" }
}
configurations.all {
// camel-xml-jaxb (via connector-common) pulls the com.sun.xml.bind
// re-publication of the JAXB runtime; the same classes already arrive via
// the canonical org.glassfish.jaxb coordinates (EclipseLink/JAXB path),
// and bootJar rejects the duplicate jaxb-core jar entry.
exclude group: 'com.sun.xml.bind', module: 'jaxb-core'
exclude group: 'com.sun.xml.bind', module: 'jaxb-impl'
}
dependencies {
// Mifos Platform BOM pins Spring Boot 3.4, EclipseLink 4, Zeebe 8, Jakarta
// EE 10 and every other shared library version. Do NOT hardcode managed
// versions. This is a deployable application, so use enforcedPlatform().
implementation enforcedPlatform('org.mifos:paymenthub-ee-bom:2.0.0-SNAPSHOT')
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// Bean Validation provider for the @Validated configuration records; without one every bind fails.
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.flywaydb:flyway-core'
// Flyway 10 moved MySQL support out of flyway-core
implementation 'org.flywaydb:flyway-mysql'
implementation 'org.mifos:paymenthub-ee-core:2.0.0-SNAPSHOT'
implementation 'org.eclipse.persistence:org.eclipse.persistence.jpa'
// mysql:mysql-connector-java was relocated to com.mysql:mysql-connector-j
implementation 'com.mysql:mysql-connector-j'
implementation 'com.zaxxer:HikariCP'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui'
implementation 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'org.springframework.boot:spring-boot-starter-cache'
// Ehcache 2 + JCache replaced by Caffeine (see CacheConfig): Spring 6
// removed EhCacheCacheManager and net.sf.ehcache is pre-Jakarta.
implementation 'com.github.ben-manes.caffeine:caffeine'
// Former dependency: org.mifos:ph-ee-id-account-validator-impl (published
// jar). The same code now lives in this repo as the validator module.
implementation project(':validator')
implementation 'io.camunda:zeebe-client-java'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
}
tasks.named('test') {
useJUnitPlatform()
}
openApi {
apiDocsUrl.set("http://localhost:8080/v3/api-docs")
outputDir.set(file("src/main/java/docs"))
outputFileName.set("swagger.yaml")
}
apply plugin:'com.diffplug.spotless'
spotless {
format 'misc', {
target '**/*.md', '**/*.properties', '**/.gitignore', '**/.openapi-generator-ignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
// Scaffold files (README, LICENSE, CODE_OF_CONDUCT, CONTRIBUTING, SECURITY) are
// owned by the org-wide repo standard, not by this repo's formatter.
targetExclude '**/build/**', '**/bin/**', '**/.settings/**', '**/.idea/**', '**/.gradle/**', '**/gradlew.bat', '**/licenses/**', '**/banner.txt', '.vscode/**', 'CODE_OF_CONDUCT.md', 'CONTRIBUTING.md', 'contributing.md', 'README.md', 'security.md'
indentWithSpaces(4)
endWithNewline()
trimTrailingWhitespace()
}
groovyGradle {
target '*.gradle', '**/*.gradle'
targetExclude '**/build/**'
greclipse()
indentWithSpaces(4)
endWithNewline()
trimTrailingWhitespace()
}
lineEndings 'UNIX'
}
configure(this) {
// NOTE: order matters!
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'checkstyle'
apply plugin: 'net.ltgt.errorprone'
configurations {
implementation.setCanBeResolved(true)
api.setCanBeResolved(true)
}
tasks.withType(JavaCompile) {
options.compilerArgs += [
"-Xlint:unchecked",
"-Xlint:cast",
"-Xlint:auxiliaryclass",
"-Xlint:deprecation",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:exports",
"-Xlint:fallthrough",
"-Xlint:finally",
"-Xlint:module",
"-Xlint:opens",
"-Xlint:options",
"-Xlint:overloads",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:removal",
"-Xlint:requires-automatic",
"-Xlint:requires-transitive-automatic",
"-Xlint:try",
"-Xlint:varargs",
"-Xlint:preview",
"-Xlint:static",
// -Werror needs to be disabled because EclipseLink's static weaving doesn't generate warning-free code
// and during an IntelliJ recompilation, it fails
//"-Werror",
"-Xmaxwarns",
1500,
"-Xmaxerrs",
1500
]
options.deprecation = true
}
// Configuration for the spotless plugin
// https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
java {
targetExclude '**/build/**', '**/bin/**', '**/out/**'
importOrder() //sort imports alphabetically
removeUnusedImports()
eclipse().configFile "$rootDir/config/iam-formatter.xml"
endWithNewline()
trimTrailingWhitespace()
// Enforce style modifier order
custom 'Modifier ordering', {
def modifierRanking = [
public : 1,
protected : 2,
private : 3,
abstract : 4,
default : 5,
static : 6,
final : 7,
transient : 8,
volatile : 9,
synchronized: 10,
native : 11,
strictfp : 12]
// Find any instance of multiple modifiers. Lead with a non-word character to avoid
// accidental matching against for instance, "an alternative default value"
it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
// Do not replace the leading non-word character. Identify the modifiers
it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
// Sort the modifiers according to the ranking above
it.split().sort({ modifierRanking[it] }).join(' ') + ' '
}
)
}
)
}
}
lineEndings 'UNIX'
}
// If we are running Gradle within Eclipse to enhance classes,
// set the classes directory to point to Eclipse's default build directory
if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') {
sourceSets.main.java.outputDir = file("$projectDir/bin/main")
}
// Configuration for the Checkstyle plugin
// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:10.3.1'
checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.42.0'
}
// Configuration for the errorprone plugin
// https://github.com/tbroyer/gradle-errorprone-plugin
dependencies {
errorprone "com.google.errorprone:error_prone_core:2.20.0"
}
tasks.withType(JavaCompile) {
options.errorprone {
enabled = project.gradle.startParameter.taskNames.contains('build') || project.gradle.startParameter.taskNames.contains('check')
disableWarningsInGeneratedCode = true
excludedPaths = ".*/build/.*"
disable(
// TODO Remove disabled checks from this list, by fixing remaining usages
"UnusedVariable",
"TypeParameterUnusedInFormals",
"EmptyBlockTag",
"MissingSummary",
"InvalidParam",
"ReturnFromVoid",
"AlmostJavadoc",
"InvalidBlockTag",
"JavaUtilDate", // TODO FINERACT-1298
"ReturnValueIgnored",
"DirectInvocationOnMock",
"CanIgnoreReturnValueSuggester",
"SameNameButDifferent", // Until errorprone recognizes Lombok
"MultiVariableDeclaration", // Until errorprone recognizes Lombok
"UnnecessaryDefaultInEnumSwitch" // FINERACT-1911
)
error(
"DefaultCharset",
"RemoveUnusedImports",
"WaitNotInLoop",
"ThreeLetterTimeZoneID",
"VariableNameSameAsType",
"UnnecessaryParentheses",
"MultipleTopLevelClasses",
"MixedMutabilityReturnType",
"AssertEqualsArgumentOrderChecker",
"EmptySetMultibindingContributions",
"BigDecimalEquals",
"MixedArrayDimensions",
"PackageLocation",
"UseBinds",
"BadImport",
"IntLongMath",
"FloatCast",
"ReachabilityFenceUsage",
"StreamResourceLeak",
"TruthIncompatibleType",
"ByteBufferBackingArray",
"OrphanedFormatString",
"CatchAndPrintStackTrace",
"ObjectToString",
"StringSplitter",
"AssertThrowsMultipleStatements",
"BoxedPrimitiveConstructor",
"EmptyCatch",
"BoxedPrimitiveEquality",
"SynchronizeOnNonFinalField",
"WildcardImport",
"PrivateConstructorForNoninstantiableModule",
"ClassCanBeStatic",
"ClassNewInstance",
"UnnecessaryStaticImport",
"UnsafeFinalization",
"JavaTimeDefaultTimeZone",
"JodaPlusMinusLong",
"SwitchDefault",
"VarTypeName",
"ArgumentSelectionDefectChecker",
"CompareToZero",
"InjectOnConstructorOfAbstractClass",
"ImmutableEnumChecker",
"NarrowingCompoundAssignment",
"MissingCasesInEnumSwitch",
"ReferenceEquality",
"UndefinedEquals",
"UnescapedEntity",
"ModifyCollectionInEnhancedForLoop",
"NonCanonicalType",
"InvalidInlineTag",
"MutablePublicArray",
"StaticAssignmentInConstructor",
"ProtectedMembersInFinalClass",
"OperatorPrecedence",
"EqualsGetClass",
"EqualsUnsafeCast",
"DoubleBraceInitialization",
"UnusedNestedClass",
"UnusedMethod",
"ModifiedButNotUsed",
"InconsistentCapitalization",
"MissingOverride",
)
}
}
}