@@ -11,6 +11,11 @@ buildscript {
1111
1212 dependencies {
1313 classpath ' ch.raffael.pegdown-doclet:pegdown-doclet:1.2.1'
14+ // Only add Spotless if running on Java 11+
15+ // TODO: Remove this when we drop support for Java 8
16+ if (JavaVersion . current() >= JavaVersion . VERSION_11 ) {
17+ classpath ' com.diffplug.spotless:spotless-plugin-gradle:6.25.0'
18+ }
1419 }
1520}
1621
@@ -19,7 +24,6 @@ plugins {
1924 id " signing"
2025 id " maven-publish"
2126 id " io.github.gradle-nexus.publish-plugin" version " 1.1.0"
22- id " com.diffplug.spotless" version " 5.12.5"
2327}
2428
2529sourceCompatibility = 1.8
@@ -29,6 +33,13 @@ version = '7.6.0'
2933
3034apply plugin : ' ch.raffael.pegdown-doclet'
3135
36+ // TODO: Remove this when we drop support for Java 8
37+ // Conditionally apply Spotless plugin only on Java 11+
38+ // (required because Spotless 6.x needs Java 11+ to load)
39+ if (JavaVersion . current() >= JavaVersion . VERSION_11 ) {
40+ apply plugin : ' com.diffplug.spotless'
41+ }
42+
3243repositories {
3344 mavenCentral()
3445 maven { url ' https://plugins.gradle.org/m2/' }
@@ -66,12 +77,12 @@ javadoc {
6677
6778task javadocJar (type : Jar , dependsOn : javadoc) {
6879 from tasks. javadoc. destinationDir
69- classifier = ' javadoc'
80+ archiveClassifier = ' javadoc'
7081}
7182
7283task sourcesJar (type : Jar ) {
7384 from sourceSets. main. allSource
74- classifier = ' sources'
85+ archiveClassifier = ' sources'
7586}
7687
7788publishing {
@@ -147,10 +158,13 @@ nexusPublishing {
147158 }
148159}
149160
150- spotless {
151- java {
152- importOrder()
153- removeUnusedImports()
154- eclipse(). configFile(" format.xml" )
161+ // Only configure Spotless if it was applied (Java 11+)
162+ if (JavaVersion . current() >= JavaVersion . VERSION_11 ) {
163+ spotless {
164+ java {
165+ importOrder()
166+ removeUnusedImports()
167+ eclipse(). configFile(" format.xml" )
168+ }
155169 }
156170}
0 commit comments