@@ -45,7 +45,7 @@ buildscript {
4545
4646plugins {
4747 id ' java-library'
48- id ' com.diffplug.spotless' version ' 6.25.0 '
48+ id ' com.diffplug.spotless' version ' 8.10.1 '
4949 id " io.freefair.lombok" version " 8.10.2"
5050 id " de.undercouch.download" version " 5.6.0"
5151}
@@ -344,14 +344,24 @@ jacocoTestReport {
344344 }
345345}
346346
347+ // Only wire the Eclipse JDT step when a spotless task is actually being run, so non-spotless
348+ // Gradle invocations (test, assemble) don't provision the formatter at configuration time.
349+ def runningSpotlessTask = gradle. startParameter. taskNames. any { it. toLowerCase(Locale . ROOT ). contains(' spotless' ) }
350+
347351spotless {
348352 if (JavaVersion . current() >= JavaVersion . VERSION_17 ) {
349353 // Spotless configuration for Java files
350354 java {
351355 removeUnusedImports()
352356 importOrder ' java' , ' javax' , ' org' , ' com'
353357 licenseHeaderFile ' spotless.license.java'
354- eclipse(). withP2Mirrors(Map . of(" https://download.eclipse.org/" , " https://ci.opensearch.org/" )). configFile rootProject. file(' .eclipseformat.xml' )
358+ // Pin 4.29 explicitly: spotless 8.10.0+ ships an embedded lockfile for it, so the
359+ // formatter resolves from Maven Central through the mirror below instead of querying a
360+ // P2 update site at configuration time. Keep withP2Mirrors so any non-lockfile fallback
361+ // still hits the ci.opensearch.org mirror rather than the eclipse.org origin.
362+ if (runningSpotlessTask) {
363+ eclipse(' 4.29' ). withP2Mirrors(Map . of(" https://download.eclipse.org/" , " https://ci.opensearch.org/" )). configFile rootProject. file(' .eclipseformat.xml' )
364+ }
355365 }
356366 } else {
357367 logger. lifecycle(" Spotless plugin requires Java 17 or higher. Skipping Spotless tasks." )
0 commit comments