77 */
88
99plugins {
10- // Apply the java-library plugin to add support for Java Library
1110 id ' java-library'
1211 id ' maven-publish'
1312 id ' signing'
2423}
2524
2625jacoco {
27- toolVersion = " 0.8.8"
28- reportsDirectory = layout. buildDirectory. dir(" $projectDir /tmp/coverage" )
26+ toolVersion = " 0.8.8"
27+ reportsDirectory = layout. buildDirectory. dir(" $projectDir /tmp/coverage" )
2928}
3029
3130jacocoTestCoverageVerification {
@@ -47,23 +46,24 @@ configurations {
4746}
4847
4948dependencies {
50- // This dependency is used internally, and not exposed to consumers on their own compile classpath.
49+ // Library dependencies
5150 implementation ' com.google.code.gson:gson:2.13.2'
5251 implementation ' org.json:json:20250517'
53- // https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5
5452 api ' com.squareup.okhttp3:okhttp:5.3.0'
5553
56- // Use JUnit test framework
54+ // JUnit 6
5755 testImplementation(platform(' org.junit:junit-bom:6.0.1' ))
5856 testImplementation(' org.junit.jupiter:junit-jupiter:6.0.1' )
59- // https://mvnrepository.com/artifact/org.mockito/mockito-core
57+
58+ // Test libs
6059 testImplementation ' org.mockito:mockito-core:4.11.0'
6160 testImplementation ' org.hamcrest:hamcrest:3.0'
6261 testImplementation ' com.squareup.okio:okio:3.16.2'
6362 testImplementation ' com.squareup.okhttp3:okhttp:5.3.0'
63+ testImplementation ' com.squareup.okhttp3:mockwebserver:5.3.0'
64+
6465 testImplementation ' com.fasterxml.jackson.core:jackson-databind:2.20.1'
6566
66- // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
6767 compileOnly group : ' com.fasterxml.jackson.core' , name : ' jackson-databind' , version : ' 2.20.1'
6868
6969 // Lombok
@@ -72,16 +72,15 @@ dependencies {
7272 testCompileOnly ' org.projectlombok:lombok:1.18.42'
7373 testAnnotationProcessor ' org.projectlombok:lombok:1.18.42'
7474
75- // Jwt
75+ // JWT
7676 implementation ' com.auth0:java-jwt:4.5.0'
7777}
7878
79- task buildJar ( type : Jar ) {
79+ tasks . register( ' buildJar ' , Jar ) {
8080 archiveBaseName = ' meilisearch-java'
8181 from {
8282 configurations. runtimeClasspath. collect { it. isDirectory() ? it : zipTree(it) }
83- }
84- {
83+ } {
8584 exclude ' META-INF/*.SF'
8685 exclude ' META-INF/*.DSA'
8786 exclude ' META-INF/*.RSA'
@@ -91,11 +90,11 @@ task buildJar(type: Jar) {
9190
9291test {
9392 useJUnitPlatform {
94- excludeTags ' integration'
93+ excludeTags ' integration'
9594 }
9695 finalizedBy jacocoTestReport
9796 testLogging {
98- events ' passed' , ' skipped' , ' failed'
97+ events ' passed' , ' skipped' , ' failed'
9998 }
10099}
101100
@@ -109,7 +108,7 @@ jacocoTestReport {
109108 finalizedBy jacocoTestCoverageVerification
110109}
111110
112- task integrationTest ( type : Test ) {
111+ tasks . register( ' integrationTest ' , Test ) {
113112 useJUnitPlatform {
114113 includeTags ' integration'
115114 }
@@ -128,7 +127,8 @@ java {
128127}
129128
130129tasks. withType(JavaCompile ). configureEach {
131- options. compilerArgs + = [' -Xlint:deprecation' , ' -Xlint:unchecked' ]
130+ options. compilerArgs + = [' -Xlint:deprecation' , ' -Xlint:unchecked' ]
131+ options. encoding = ' UTF-8'
132132}
133133
134134publishing {
@@ -168,13 +168,10 @@ publishing {
168168nexusPublishing {
169169 repositories {
170170 sonatype {
171- // Point to new Central Portal staging API (replaces oss.sonatype.org)
172171 nexusUrl. set(uri(" https://ossrh-staging-api.central.sonatype.com/service/local/" ))
173172 snapshotRepositoryUrl. set(uri(" https://central.sonatype.com/repository/maven-snapshots/" ))
174- // Credentials: use Central Portal token (username/password)
175- username. set(System . getenv(" MAVEN_CENTRAL_USERNAME" )) // portal token user
176- password. set(System . getenv(" MAVEN_CENTRAL_PASSWORD" )) // portal token password
177- // packageGroup or stagingProfileId not needed if using nexus-publish-plugin
173+ username. set(System . getenv(" MAVEN_CENTRAL_USERNAME" ))
174+ password. set(System . getenv(" MAVEN_CENTRAL_PASSWORD" ))
178175 }
179176 }
180177}
@@ -185,17 +182,13 @@ signing {
185182}
186183
187184javadoc {
188- if (JavaVersion . current(). isJava9Compatible()) {
185+ if (JavaVersion . current(). isJava9Compatible()) {
189186 options. addBooleanOption(' html5' , true )
190187 }
191188}
192189
193190spotless {
194-
195191 java {
196- // don't need to set target, it is inferred from java
197-
198- // apply a specific flavor of google-java-format
199192 googleJavaFormat(' 1.10.0' ). aosp()
200193 }
201194}
0 commit comments