Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
239 lines (207 loc) · 7.84 KB
/
Copy pathbuild.gradle
File metadata and controls
239 lines (207 loc) · 7.84 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
plugins {
id 'java'
id 'maven-publish'
// JReleaser for publishing to Maven Central
id 'org.jreleaser' version '1.21.0'
id 'checkstyle'
}
group = 'org.interledger'
version = project.findProperty('release.version') ?: '0.0.1-SNAPSHOT'
description = 'The OpenPayments Java SDK.'
// Set a proper artifact name
def artifactName = 'open-payments'
repositories {
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withJavadocJar()
withSourcesJar()
}
ext {
jacksonVersion = '2.17.1'
junitVersion = '5.10.2'
loggerVersion = '2.0.17'
logbackClassicVersion = '1.5.17'
lombokVersion = '1.18.42'
mockitoVersion = '5.14.2'
seleniumVersion = '4.41.0'
webDriverManagerVersion = '6.1.0'
}
// Define source sets for integration tests
sourceSets {
integrationTest {
java.srcDir 'src/integrationTest/java'
resources.srcDir 'src/integrationTest/resources'
compileClasspath += sourceSets.main.output + sourceSets.test.output
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
}
}
// Create a configuration for integration test implementation dependencies
configurations {
integrationTestImplementation {
extendsFrom configurations.testImplementation
}
integrationTestRuntimeOnly {
extendsFrom configurations.testRuntimeOnly
}
}
// Create custom integrationTest task
tasks.register('integrationTest', Test) {
description = 'Runs the integration tests.'
group = 'verification'
// Link this task to the `integrationTest` source set
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
useJUnitPlatform() // JUnit 5 platform for tests
// Optional: Enable logging for debugging purposes
testLogging {
events = ['PASSED', 'FAILED', 'SKIPPED']
}
}
// Configure duplicate handling for integration test resources
tasks.named('processIntegrationTestResources', ProcessResources).configure {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
// Standard test task
tasks.test {
useJUnitPlatform()
testLogging {
events 'PASSED', 'FAILED', 'SKIPPED'
}
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:all/public')
failOnError = false
}
checkstyle {
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
toolVersion = '10.12.4'
ignoreFailures = false
maxWarnings = 0
}
tasks.withType(Checkstyle).configureEach {
showViolations = true
reports {
xml.required = true
xml.outputLocation = file("${rootDir}/build/reports/checkstyle/${project.name}-checkstyle.xml")
html.required = true
html.outputLocation = file("${rootDir}/build/reports/checkstyle/${project.name}-checkstyle.html")
}
ignoreFailures = false
maxErrors = 0
maxWarnings = 0
}
dependencies {
// Compiling
// Latest Lombok always.
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
// Logging
implementation "org.slf4j:slf4j-api:${loggerVersion}"
// Serialization / Deserialization
implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}"
// Unit tests
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
testImplementation "ch.qos.logback:logback-classic:${logbackClassicVersion}"
// Integration tests - explicitly declare test framework dependencies
integrationTestImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
integrationTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
integrationTestImplementation "ch.qos.logback:logback-classic:${logbackClassicVersion}"
integrationTestImplementation project(':')
integrationTestImplementation "org.seleniumhq.selenium:selenium-java:${seleniumVersion}"
integrationTestImplementation "io.github.bonigarcia:webdrivermanager:${webDriverManagerVersion}"
// Needed for Gradle 9.0
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
integrationTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
integrationTestCompileOnly "org.projectlombok:lombok:${lombokVersion}"
integrationTestAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
}
publishing {
repositories {
maven {
url = layout.buildDirectory.dir('staging-deploy')
}
}
publications {
maven(MavenPublication) {
from components.java
// Set the artifact name explicitly
groupId = 'org.interledger'
artifactId = artifactName
pom {
name = artifactName
description = 'Java client for Interledger Open Payments protocol'
url = 'https://github.com/interledger/open-payments-java'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'koekiebox'
name = 'Jason Bruwer'
email = 'jason@interledger.org'
organization = 'Interledger'
organizationUrl = 'https://interledger.org'
}
developer {
id = 'oana-lolea'
name = 'Oana Lolea'
email = 'oana.lolea@breakpointit.eu'
organization = 'Breakpoint'
organizationUrl = 'https://breakpointit.eu'
}
}
organization {
name = 'Interledger'
url = 'https://interledger.org'
}
scm {
connection = 'scm:git:git://github.com/interledger/open-payments-java.git'
developerConnection = 'scm:git:ssh://github.com/interledger/open-payments-java.git'
url = 'https://github.com/interledger/open-payments-java'
}
}
}
}
}
// Configure artifact signing for Maven Central via JReleaser (preferred)
jreleaser {
project {
// Used by JReleaser in release metadata/announcements
copyright = "2025 Interledger"
}
// Reuse project info from Gradle (group, version, POM metadata)
signing {
active = 'ALWAYS'
armored = true
mode = 'MEMORY'
}
deploy {
maven {
// Use the new Central Portal publisher API
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
stagingRepository('build/staging-deploy')
username = (findProperty('JRELEASER_MAVENCENTRAL_USERNAME') ?: System.getenv('JRELEASER_MAVENCENTRAL_USERNAME'))
password = (findProperty('JRELEASER_MAVENCENTRAL_PASSWORD') ?: System.getenv('JRELEASER_MAVENCENTRAL_PASSWORD'))
}
}
}
}
}