diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index acac6adcdc..47974efc19 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,7 +15,7 @@ concurrency:
jobs:
sanity-check:
name: Sanity Check
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04-arm
env:
# Only push to the remote build cache on push events to prevent cache pollution and poisoning from PRs.
buildcacheuser: ${{ github.event_name == 'push' && secrets.BUILDCACHE_USER || '' }}
@@ -26,7 +26,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v6
with:
- distribution: "temurin"
+ distribution: 'zulu'
java-version: 21
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew spotlessCheck
@@ -38,17 +38,17 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ ubuntu-latest ]
- jre: [ 17, 21, 24 ] # Test on all supported LTS and latest JDK.
+ os: [ ubuntu-24.04-arm ]
+ jre: [ 17, 21, 25, 26 ] # Test on all supported LTS and latest JDK.
include:
- - os: windows-latest
- jre: 24 # Test on the latest JDK for speeds.
+ - os: windows-11-arm
+ jre: 25 # Test on the latest LTS for speeds.
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
- distribution: "temurin"
+ distribution: 'zulu'
java-version: ${{ matrix.jre }}
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
@@ -66,17 +66,17 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ ubuntu-latest ]
- jre: [ 17, 21, 24 ] # Test on all supported LTS and latest JDK.
+ os: [ ubuntu-24.04-arm ]
+ jre: [ 17, 21, 25, 26 ] # Test on all supported LTS and latest JDK.
include:
- - os: windows-latest
- jre: 24 # Test on the latest JDK for speeds.
+ - os: windows-11-arm
+ jre: 25 # Test on the latest LTS for speeds.
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
- distribution: "temurin"
+ distribution: 'zulu'
java-version: ${{ matrix.jre }}
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew :plugin-maven:build -x spotlessCheck
@@ -91,12 +91,12 @@ jobs:
test-npm:
name: NPM
needs: sanity-check
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
- distribution: "temurin"
+ distribution: 'zulu'
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew testNpm
@@ -111,12 +111,12 @@ jobs:
test-shfmt:
name: Shfmt
needs: sanity-check
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
- distribution: "temurin"
+ distribution: 'zulu'
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- uses: actions/setup-go@v7
@@ -138,12 +138,12 @@ jobs:
test-idea:
name: IntelliJ IDEA
needs: sanity-check
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
- distribution: "temurin"
+ distribution: 'zulu'
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- name: Test idea
diff --git a/CHANGES.md b/CHANGES.md
index 568145ae29..4c6ad3fbe7 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -21,6 +21,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
- Bump default `jackson` version `2.20.1` -> `2.22.2`. ([#2819](https://github.com/diffplug/spotless/pull/2819))
- Bump default `javaparser` version `3.27.1` -> `3.28.2`. ([#3065](https://github.com/diffplug/spotless/pull/3065))
- Bump default `palantir-java-format` version `2.80.0` -> `2.98.0`. ([#3068](https://github.com/diffplug/spotless/pull/3068))
+- Bump default `google-java-format` version `1.30.0` -> `1.36.1`. ([#3075](https://github.com/diffplug/spotless/pull/3075))
### Fixed
- `VersionCatalogStep` preserves entries when comments contain unmatched brackets, preserves commas inside quoted strings, and keeps significant line boundaries in multiline entries. ([#3042](https://github.com/diffplug/spotless/pull/3042))
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index fd871804cd..b4c4bf6b0f 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -50,7 +50,7 @@ diktat-runner = "com.saveourtool.diktat:diktat-runner:2.0.0"
flexmark-all = "com.vladsch.flexmark:flexmark-all:0.64.8"
freshmark = "com.diffplug.freshmark:freshmark:1.3.1"
gherkin-utils = "io.cucumber:gherkin-utils:10.0.0"
-google-java-format = "com.google.googlejavaformat:google-java-format:1.30.0"
+google-java-format = "com.google.googlejavaformat:google-java-format:1.36.1"
gson = "com.google.code.gson:gson:2.14.0"
json-simple = "org.json:json:20210307"
ktfmt = "com.facebook:ktfmt:0.64"
diff --git a/gradle/pinned-libs.versions.toml b/gradle/pinned-libs.versions.toml
index 8d3cae34c2..9f645d1161 100644
--- a/gradle/pinned-libs.versions.toml
+++ b/gradle/pinned-libs.versions.toml
@@ -11,7 +11,7 @@ maven-plugin-annotations = { module = "org.apache.maven.plugin-tools:maven-plugi
maven-core = { module = "org.apache.maven:maven-core", version.ref = "maven" }
palantir-java-format = "com.palantir.javaformat:palantir-java-format:1.1.0"
-google-java-format = "com.google.googlejavaformat:google-java-format:1.7"
+google-java-format = "com.google.googlejavaformat:google-java-format:1.28.0"
diktat-rules = "org.cqfn.diktat:diktat-rules:1.2.5"
aether-api = "org.eclipse.aether:aether-api:1.1.0"
plexus-build-api = "org.sonatype.plexus:plexus-build-api:0.0.7"
diff --git a/lib-extra/src/test/java/com/diffplug/spotless/extra/GitRachetMergeBaseTest.java b/lib-extra/src/test/java/com/diffplug/spotless/extra/GitRachetMergeBaseTest.java
index f8592a895d..7645b9d4f6 100644
--- a/lib-extra/src/test/java/com/diffplug/spotless/extra/GitRachetMergeBaseTest.java
+++ b/lib-extra/src/test/java/com/diffplug/spotless/extra/GitRachetMergeBaseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2025 DiffPlug
+ * Copyright 2020-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -331,6 +331,6 @@ private Git initRepo() throws IllegalStateException, GitAPIException, IOExceptio
private void addAndCommit(Git git, String message) throws GitAPIException {
git.add().addFilepattern(".").call();
- git.commit().setMessage(message).call();
+ git.commit().setSign(false).setMessage(message).call();
}
}
diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts
index e552219f58..2992c4a33f 100644
--- a/lib/build.gradle.kts
+++ b/lib/build.gradle.kts
@@ -151,7 +151,7 @@ dependencies {
"gherkinCompileOnly"(libs.gherkin.utils)
"gherkinCompileOnly"(libs.slf4j.api)
// googleJavaFormat
- "googleJavaFormatCompileOnly"(libs.google.java.format)
+ "googleJavaFormatCompileOnly"(pinnedLibs.google.java.format)
// gson
"gsonCompileOnly"(libs.gson)
// jackson
diff --git a/lib/spotbugs-exclude.xml b/lib/spotbugs-exclude.xml
index 1739443b83..807778a209 100644
--- a/lib/spotbugs-exclude.xml
+++ b/lib/spotbugs-exclude.xml
@@ -20,4 +20,9 @@
+
+
+
+
+
diff --git a/lib/src/main/java/com/diffplug/spotless/rdf/RdfFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/rdf/RdfFormatterStep.java
index 4a538b19ec..88afa3b5a8 100644
--- a/lib/src/main/java/com/diffplug/spotless/rdf/RdfFormatterStep.java
+++ b/lib/src/main/java/com/diffplug/spotless/rdf/RdfFormatterStep.java
@@ -22,6 +22,7 @@
import java.util.Objects;
import java.util.TreeMap;
+import com.diffplug.spotless.FormatterFunc;
import com.diffplug.spotless.FormatterStep;
import com.diffplug.spotless.JarState;
import com.diffplug.spotless.Jvm;
@@ -53,10 +54,10 @@ public static State state(RdfFormatterStep step) {
return new State(step.config, step.turtleFormatterStyle, step.jarState.get());
}
- public static RdfFormatterFunc formatterFunc(State state)
+ public static FormatterFunc formatterFunc(State state)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
var formatterFunc = new RdfFormatterFunc(state);
- return (RdfFormatterFunc) JVM_SUPPORT.suggestLaterVersionOnError(state.config.getTurtleFormatterVersion(), formatterFunc);
+ return JVM_SUPPORT.suggestLaterVersionOnError(state.config.getTurtleFormatterVersion(), formatterFunc);
}
public RdfFormatterStep(JarState.Promised jarState, RdfFormatterConfig config,
diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md
index 77c06e32d5..a6fcf92cdb 100644
--- a/plugin-gradle/CHANGES.md
+++ b/plugin-gradle/CHANGES.md
@@ -13,6 +13,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
- Bump default `jackson` version `2.20.1` -> `2.22.2`. ([#2819](https://github.com/diffplug/spotless/pull/2819))
- Bump default `javaparser` version `3.27.1` -> `3.28.2`. ([#3065](https://github.com/diffplug/spotless/pull/3065))
- Bump default `palantir-java-format` version `2.80.0` -> `2.98.0`. ([#3068](https://github.com/diffplug/spotless/pull/3068))
+- Bump default `google-java-format` version `1.30.0` -> `1.36.1`. ([#3075](https://github.com/diffplug/spotless/pull/3075))
### Fixed
- `versionCatalog()` preserves entries when comments contain unmatched brackets, preserves commas inside quoted strings, and keeps significant line boundaries in multiline entries. ([#3042](https://github.com/diffplug/spotless/pull/3042))
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GitRatchetGradleTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GitRatchetGradleTest.java
index 0e3cb3f283..be48e23b9d 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GitRatchetGradleTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GitRatchetGradleTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2025 DiffPlug
+ * Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ void singleProjectExhaustive(int useConfigCache) throws Exception {
"}");
setFile(TEST_PATH).toContent("HELLO");
git.add().addFilepattern(TEST_PATH).call();
- git.commit().setMessage("Initial state").call();
+ git.commit().setSign(false).setMessage("Initial state").call();
// tag this initial state as the baseline for spotless to ratchet from
git.tag().setName("baseline").call();
@@ -271,7 +271,7 @@ public BuildResultAssertion outcome(String taskPath, TaskOutcome expected) {
private RevCommit addAndCommit(Git git) throws NoFilepatternException, GitAPIException {
PersonIdent emptyPerson = new PersonIdent("jane doe", "jane@doe.com", new Date(0), TimeZone.getTimeZone("UTC"));
git.add().addFilepattern(".").call();
- return git.commit().setMessage("baseline")
+ return git.commit().setSign(false).setMessage("baseline")
.setCommitter(emptyPerson)
.setAuthor(emptyPerson)
.call();
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java
index e7fc9d4b74..dde872d3e5 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 DiffPlug
+ * Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,11 @@
import org.junit.jupiter.api.Test;
+import com.diffplug.spotless.Jvm;
+
class GoogleJavaFormatIntegrationTest extends GradleIntegrationHarness {
+ private static final String NON_DEFAULT_VERSION = Jvm.version() <= 17 ? "1.27.0" : "1.34.1";
+
@Test
void integration() throws IOException {
setFile("build.gradle").toLines(
@@ -31,7 +35,7 @@ void integration() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0')",
+ " googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
" }",
"}");
@@ -41,7 +45,7 @@ void integration() throws IOException {
checkRunsThenUpToDate();
replace("build.gradle",
- "googleJavaFormat('1.17.0')",
+ "googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
"googleJavaFormat()");
checkRunsThenUpToDate();
}
@@ -57,7 +61,7 @@ void integrationWithReorderImports() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0').aosp().reorderImports(true)",
+ " googleJavaFormat('" + NON_DEFAULT_VERSION + "').aosp().reorderImports(true)",
" }",
"}");
@@ -67,7 +71,7 @@ void integrationWithReorderImports() throws IOException {
checkRunsThenUpToDate();
replace("build.gradle",
- "googleJavaFormat('1.17.0')",
+ "googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
"googleJavaFormat()");
checkRunsThenUpToDate();
}
@@ -83,7 +87,7 @@ void integrationWithSkipJavadocFormatting() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0').skipJavadocFormatting()",
+ " googleJavaFormat('" + NON_DEFAULT_VERSION + "').skipJavadocFormatting()",
" }",
"}");
@@ -93,7 +97,7 @@ void integrationWithSkipJavadocFormatting() throws IOException {
checkRunsThenUpToDate();
replace("build.gradle",
- "googleJavaFormat('1.17.0')",
+ "googleJavaFormat('" + NON_DEFAULT_VERSION + "')",
"googleJavaFormat()");
checkRunsThenUpToDate();
}
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java
index 0e223a3409..c29d98329d 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java
@@ -55,9 +55,12 @@ public enum GradleVersionSupport {
GradleVersionSupport(String version) {
String minVersionForRunningJRE;
switch (Jvm.version()) {
- case 26:
- throw new IllegalStateException("Gradle does not yet support running on Java 26. " +
+ case 27:
+ throw new IllegalStateException("Gradle does not yet support running on Java 27. " +
"You need to update the case ref to https://docs.gradle.org/current/userguide/compatibility.html.");
+ case 26:
+ minVersionForRunningJRE = "9.4.0";
+ break;
case 25:
minVersionForRunningJRE = "9.1.0";
break;
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinExtensionTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinExtensionTest.java
index f986d83717..610a35c9f7 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinExtensionTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinExtensionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2025 DiffPlug
+ * Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ class KotlinExtensionTest extends GradleIntegrationHarness {
void integrationDiktat() throws IOException {
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
@@ -49,7 +49,7 @@ void integrationKtfmtDropboxStyleWithPublicApi() throws IOException {
setFile("build.gradle.kts").toLines(
"import com.diffplug.spotless.kotlin.KtfmtStep.TrailingCommaManagementStrategy",
"plugins {",
- " id(\"org.jetbrains.kotlin.jvm\") version \"1.6.21\"",
+ " id(\"org.jetbrains.kotlin.jvm\") version \"2.1.10\"",
" id(\"com.diffplug.spotless\")",
"}",
"repositories { mavenCentral() }",
@@ -73,7 +73,7 @@ void integrationKtfmtDropboxStyleWithPublicApi() throws IOException {
void withExperimentalEditorConfigOverride() throws IOException {
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
@@ -97,7 +97,7 @@ void testWithInvalidEditorConfigFile() throws IOException {
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
@@ -117,7 +117,7 @@ void testReadCodeStyleFromEditorConfigFile() throws IOException {
setFile(".editorconfig").toResource("kotlin/ktlint/ktlint_official/.editorconfig");
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
@@ -134,7 +134,7 @@ void testEditorConfigOverrideWithUnsetCodeStyleDoesNotOverrideEditorConfigCodeSt
setFile(".editorconfig").toResource("kotlin/ktlint/ktlint_official/.editorconfig");
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
@@ -153,7 +153,7 @@ void testSetEditorConfigCanOverrideEditorConfigFile() throws IOException {
setFile(".editorconfig").toResource("kotlin/ktlint/intellij_idea/.editorconfig");
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
@@ -171,7 +171,7 @@ void testSetEditorConfigCanOverrideEditorConfigFile() throws IOException {
void withCustomRuleSetApply() throws IOException {
setFile("build.gradle.kts").toLines(
"plugins {",
- " id(\"org.jetbrains.kotlin.jvm\") version \"1.6.21\"",
+ " id(\"org.jetbrains.kotlin.jvm\") version \"2.1.10\"",
" id(\"com.diffplug.spotless\")",
"}",
"repositories { mavenCentral() }",
@@ -195,7 +195,7 @@ void withCustomRuleSetApply() throws IOException {
void testWithHeader() throws IOException {
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
@@ -214,7 +214,7 @@ void testWithHeader() throws IOException {
void testWithCustomMaxWidthDefaultStyleKtfmt() throws IOException {
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinGradleExtensionTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinGradleExtensionTest.java
index c607c36912..b356bef180 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinGradleExtensionTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinGradleExtensionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 DiffPlug
+ * Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ class KotlinGradleExtensionTest extends KotlinExtensionTest {
void testTarget(boolean useDefaultTarget) throws IOException {
setFile("build.gradle").toLines(
"plugins {",
- " id 'org.jetbrains.kotlin.jvm' version '1.6.21'",
+ " id 'org.jetbrains.kotlin.jvm' version '2.1.10'",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/LicenseHeaderTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/LicenseHeaderTest.java
index 5071762b5f..fc8d63e4a9 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/LicenseHeaderTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/LicenseHeaderTest.java
@@ -163,7 +163,7 @@ void filterByContentPatternTest() throws IOException {
@Test
void ratchetFrom() throws Exception {
try (Git git = Git.init().setDirectory(rootFolder()).call()) {
- git.commit().setMessage("First commit").call();
+ git.commit().setSign(false).setMessage("First commit").call();
}
setLicenseStep("licenseHeader('/** $YEAR */')\nratchetFrom 'HEAD'");
testSuiteUpdateWithLatest(true);
@@ -172,7 +172,7 @@ void ratchetFrom() throws Exception {
@Test
void ratchetFromButUpdateFalse() throws Exception {
try (Git git = Git.init().setDirectory(rootFolder()).call()) {
- git.commit().setMessage("First commit").call();
+ git.commit().setSign(false).setMessage("First commit").call();
}
try (Git ignored = Git.init().setDirectory(rootFolder()).call()) {
setLicenseStep("licenseHeader('/** $YEAR */').updateYearWithLatest(false)\nratchetFrom 'HEAD'");
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java
index 3403bbfaad..5a9045ac06 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java
@@ -21,6 +21,7 @@
import org.junit.jupiter.api.Test;
import com.diffplug.common.base.StringPrinter;
+import com.diffplug.spotless.java.GoogleJavaFormatStep;
class MultiProjectTest extends GradleIntegrationHarness {
private static final int N = 100;
@@ -47,7 +48,7 @@ void createSubproject(String name) throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0')",
+ " googleJavaFormat()",
" }",
"}");
setFile(name + "/test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test");
@@ -71,7 +72,7 @@ public void hasRootSpotless() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0')",
+ " googleJavaFormat()",
" }",
"}");
setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test");
@@ -88,7 +89,7 @@ public void predeclaredFails() throws IOException {
"spotless { predeclareDeps() }");
createNSubprojects();
Assertions.assertThat(gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput())
- .contains("Add a step with [com.google.googlejavaformat:google-java-format:1.17.0] into the `spotlessPredeclare` block in the root project.");
+ .contains("Add a step with [com.google.googlejavaformat:google-java-format:" + GoogleJavaFormatStep.defaultVersion() + "] into the `spotlessPredeclare` block in the root project.");
}
@Test
@@ -101,7 +102,7 @@ public void predeclaredSucceeds_deprecatedAPI() throws IOException {
"spotless { predeclareDeps() }",
"",
"spotlessPredeclare {",
- " java { googleJavaFormat('1.17.0') }",
+ " java { googleJavaFormat() }",
"}");
createNSubprojects();
gradleRunner().withArguments("spotlessApply").build();
@@ -119,7 +120,7 @@ public void predeclaredFromBuildscriptSucceeds_deprecatedAPI() throws IOExceptio
"repositories { mavenCentral() }",
"spotless { predeclareDepsFromBuildscript() }",
"spotlessPredeclare {",
- " java { googleJavaFormat('1.17.0') }",
+ " java { googleJavaFormat() }",
"}");
createNSubprojects();
gradleRunner().withArguments("spotlessApply").build();
@@ -138,7 +139,7 @@ public void predeclaredFromBuildscriptInPredeclareBlockSucceeds() throws IOExcep
"",
"spotlessPredeclare {",
" fromBuildscriptRepositories()",
- " java { googleJavaFormat('1.17.0') }",
+ " java { googleJavaFormat() }",
"}");
createNSubprojects();
gradleRunner().withArguments("spotlessApply").build();
@@ -152,7 +153,7 @@ public void predeclaredOrderingIsFlexible() throws IOException {
"}",
"repositories { mavenCentral() }",
"spotlessPredeclare {",
- " java { googleJavaFormat('1.17.0') }",
+ " java { googleJavaFormat() }",
"}",
"spotless { predeclareDeps() }");
createNSubprojects();
@@ -169,11 +170,11 @@ public void predeclaredDepsRegression() throws IOException {
" predeclareDeps()",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0')",
+ " googleJavaFormat()",
" }",
"}",
"spotlessPredeclare {",
- " java { googleJavaFormat('1.17.0') }",
+ " java { googleJavaFormat() }",
"}");
setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test");
setFile("sub/build.gradle").toLines(
@@ -182,11 +183,11 @@ public void predeclaredDepsRegression() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0')",
+ " googleJavaFormat()",
" }",
"}");
setFile("sub/test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test");
- gradleRunner().withGradleVersion("8.14").withArguments("spotlessApply").build();
+ gradleRunner().withArguments("spotlessApply").build();
}
@Test
@@ -197,7 +198,7 @@ public void predeclaredWithoutSpotlessBlockSucceeds() throws IOException {
"}",
"repositories { mavenCentral() }",
"spotlessPredeclare {",
- " java { googleJavaFormat('1.17.0') }",
+ " java { googleJavaFormat() }",
"}");
createNSubprojects();
gradleRunner().withArguments("spotlessApply").build();
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java
index b41331765c..2df13ef405 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2025 DiffPlug
+ * Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,13 +29,13 @@ void useNodeAndNpmFromNodeGradlePlugin() throws Exception {
setFile("build.gradle").toLines(
"plugins {",
" id 'com.diffplug.spotless'",
- " id 'com.github.node-gradle.node' version '3.5.1'",
+ " id 'com.github.node-gradle.node' version '7.1.0'",
"}",
"repositories { mavenCentral() }",
"node {",
" download = true",
- " version = '18.16.1'",
- " npmVersion = '9.5.1'",
+ " version = '22.14.0'",
+ " npmVersion = '10.9.2'",
" workDir = file(\"${buildDir}/nodejs\")",
" npmWorkDir = file(\"${buildDir}/npm\")",
"}",
@@ -106,12 +106,12 @@ void useNpmFromNodeGradlePlugin() throws Exception {
setFile("build.gradle").toLines(
"plugins {",
" id 'com.diffplug.spotless'",
- " id 'com.github.node-gradle.node' version '3.5.1'",
+ " id 'com.github.node-gradle.node' version '7.1.0'",
"}",
"repositories { mavenCentral() }",
"node {",
" download = true",
- " version = '18.16.1'",
+ " version = '22.14.0'",
" workDir = file(\"${buildDir}/nodejs\")",
"}",
"def prettierConfig = [:]",
@@ -145,12 +145,12 @@ void useNpmNextToConfiguredNodePluginFromNodeGradlePlugin() throws Exception {
setFile("build.gradle").toLines(
"plugins {",
" id 'com.diffplug.spotless'",
- " id 'com.github.node-gradle.node' version '3.5.1'",
+ " id 'com.github.node-gradle.node' version '7.1.0'",
"}",
"repositories { mavenCentral() }",
"node {",
" download = true",
- " version = '18.13.0'",
+ " version = '22.14.0'",
" workDir = file(\"${buildDir}/nodejs\")",
"}",
"def prettierConfig = [:]",
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/PalantirJavaFormatIntegrationTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/PalantirJavaFormatIntegrationTest.java
index 9990039cd3..02538ff763 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/PalantirJavaFormatIntegrationTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/PalantirJavaFormatIntegrationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 DiffPlug
+ * Copyright 2022-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ void formatJavaDoc() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " palantirJavaFormat('2.39.0').formatJavadoc(true)",
+ " palantirJavaFormat().formatJavadoc(true)",
" }",
"}");
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskBuildDirTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskBuildDirTest.java
index 0fedd8e099..aec9a3a830 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskBuildDirTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskBuildDirTest.java
@@ -34,7 +34,7 @@ void unitOutputFollowsCustomBuildDirectory() throws IOException {
"spotless { predeclareDeps() }",
"",
"spotlessPredeclare {",
- " java { googleJavaFormat('1.17.0') }",
+ " java { googleJavaFormat() }",
"}",
"",
"layout.buildDirectory = layout.projectDirectory.dir('custom-build')");
@@ -45,7 +45,7 @@ void unitOutputFollowsCustomBuildDirectory() throws IOException {
"spotless {",
" java {",
" target 'src/main/java/**/*.java'",
- " googleJavaFormat('1.17.0')",
+ " googleJavaFormat()",
" }",
"}");
setFile("sub/src/main/java/Hello.java").toLines(
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpotlessPredeclareIntegrationTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpotlessPredeclareIntegrationTest.java
index 5f54de218d..c765d46fd1 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpotlessPredeclareIntegrationTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpotlessPredeclareIntegrationTest.java
@@ -23,6 +23,8 @@
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
+import com.diffplug.spotless.java.GoogleJavaFormatStep;
+
/**
* Integration tests for the spotlessPredeclare feature, which allows dependencies
* to be predeclared in the root project and reused across all subprojects to avoid
@@ -41,7 +43,7 @@ void predeclareSucceedsWithMavenDependencies() throws IOException {
repositories { mavenCentral() }
spotless { predeclareDeps() }
spotlessPredeclare {
- java { googleJavaFormat('1.17.0') }
+ java { googleJavaFormat() }
}
""");
setFile("settings.gradle").toContent("include 'sub'");
@@ -53,7 +55,7 @@ void predeclareSucceedsWithMavenDependencies() throws IOException {
spotless {
java {
target file('test.java')
- googleJavaFormat('1.17.0')
+ googleJavaFormat()
}
}
""");
@@ -85,7 +87,7 @@ void predeclareFailsWhenDependencyNotPredeclared() throws IOException {
spotless {
java {
target file('test.java')
- googleJavaFormat('1.17.0')
+ googleJavaFormat()
}
}
""");
@@ -93,7 +95,7 @@ target file('test.java')
BuildResult result = gradleRunner().withArguments("spotlessApply").buildAndFail();
assertThat(result.getOutput())
- .contains("Add a step with [com.google.googlejavaformat:google-java-format:1.17.0]")
+ .contains("Add a step with [com.google.googlejavaformat:google-java-format:" + GoogleJavaFormatStep.defaultVersion() + "]")
.contains("into the `spotlessPredeclare` block in the root project");
}
@@ -106,7 +108,7 @@ void predeclareWorksWithMultipleVersions() throws IOException {
repositories { mavenCentral() }
spotless { predeclareDeps() }
spotlessPredeclare {
- java { googleJavaFormat('1.17.0') }
+ java { googleJavaFormat() }
}
""");
setFile("settings.gradle").toContent("include 'sub1', 'sub2'");
@@ -118,7 +120,7 @@ void predeclareWorksWithMultipleVersions() throws IOException {
spotless {
java {
target file('test.java')
- googleJavaFormat('1.17.0')
+ googleJavaFormat()
}
}
""");
@@ -131,7 +133,7 @@ target file('test.java')
spotless {
java {
target file('test.java')
- googleJavaFormat('1.17.0')
+ googleJavaFormat()
}
}
""");
@@ -469,7 +471,7 @@ void predeclareWorksWithBothMavenAndP2Dependencies() throws IOException {
spotless { predeclareDeps() }
spotlessPredeclare {
java {
- googleJavaFormat('1.17.0')
+ googleJavaFormat()
eclipse()
}
}
@@ -483,7 +485,7 @@ void predeclareWorksWithBothMavenAndP2Dependencies() throws IOException {
spotless {
java {
target file('test.java')
- googleJavaFormat('1.17.0')
+ googleJavaFormat()
}
}
""");
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ToggleOffOnTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ToggleOffOnTest.java
index 3504a70e49..28ebf2938b 100644
--- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ToggleOffOnTest.java
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ToggleOffOnTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2025 DiffPlug
+ * Copyright 2020-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -104,7 +104,7 @@ void gjf() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
- " googleJavaFormat('1.17.0')",
+ " googleJavaFormat()",
" toggleOffOn()",
" }",
"}");
diff --git a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle
index c0fa255bcc..67789283e3 100644
--- a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle
+++ b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle
@@ -4,13 +4,13 @@
*/
plugins {
id 'com.diffplug.spotless'
- id 'com.github.node-gradle.node' version '3.5.1'
+ id 'com.github.node-gradle.node' version '7.1.0'
}
repositories { mavenCentral() }
node {
download = true
- version = '18.16.1'
- npmVersion = '9.5.1'
+ version = '22.14.0'
+ npmVersion = '10.9.2'
// when setting both these directories, npm and node will be in separate directories
workDir = file("${buildDir}/nodejs")
npmWorkDir = file("${buildDir}/npm")
diff --git a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle
index 6d77bc3d69..59f694b299 100644
--- a/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle
+++ b/plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle
@@ -4,12 +4,12 @@
*/
plugins {
id 'com.diffplug.spotless'
- id 'com.github.node-gradle.node' version '3.5.1'
+ id 'com.github.node-gradle.node' version '7.1.0'
}
repositories { mavenCentral() }
node {
download = true
- version = '18.16.1'
+ version = '22.14.0'
// when not setting an explicit `npmWorkDir`, the npm binary will be installed next to the node binary
workDir = file("${buildDir}/nodejs")
}
diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md
index 07491af14d..dcf2e7a504 100644
--- a/plugin-maven/CHANGES.md
+++ b/plugin-maven/CHANGES.md
@@ -13,6 +13,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
- Bump default `jackson` version `2.20.1` -> `2.22.2`. ([#2819](https://github.com/diffplug/spotless/pull/2819))
- Bump default `javaparser` version `3.27.1` -> `3.28.2`. ([#3065](https://github.com/diffplug/spotless/pull/3065))
- Bump default `palantir-java-format` version `2.80.0` -> `2.98.0`. ([#3068](https://github.com/diffplug/spotless/pull/3068))
+- Bump default `google-java-format` version `1.30.0` -> `1.36.1`. ([#3075](https://github.com/diffplug/spotless/pull/3075))
### Fixed
- `` preserves entries when comments contain unmatched brackets, preserves commas inside quoted strings, and keeps significant line boundaries in multiline entries. ([#3042](https://github.com/diffplug/spotless/pull/3042))
diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/GitRatchetMavenTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/GitRatchetMavenTest.java
index faedaad602..56bb2e666e 100644
--- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/GitRatchetMavenTest.java
+++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/GitRatchetMavenTest.java
@@ -88,7 +88,7 @@ void singleProjectExhaustiveGlobal() throws Exception {
private void checkBehavior(Git git) throws Exception {
setFile(TEST_PATH).toContent("HELLO");
git.add().addFilepattern(TEST_PATH).call();
- git.commit().setMessage("Initial state").call();
+ git.commit().setSign(false).setMessage("Initial state").call();
// tag this initial state as the baseline for spotless to ratchet from
git.tag().setName("baseline").call();
@@ -165,7 +165,7 @@ void worktreeSupport() throws Exception {
setFile(TEST_PATH).toContent("HELLO");
mainGit.add().addFilepattern(TEST_PATH).call();
- mainGit.commit().setMessage("Initial commit").call();
+ mainGit.commit().setSign(false).setMessage("Initial commit").call();
mainGit.tag().setName("baseline").call();
// Set up a worktree manually (JGit doesn't support worktrees)
diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/LicenseHeaderRatchetTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/LicenseHeaderRatchetTest.java
index 24200020f2..917c11688d 100644
--- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/LicenseHeaderRatchetTest.java
+++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/generic/LicenseHeaderRatchetTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 DiffPlug
+ * Copyright 2020-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ void normal() throws Exception {
@Test
void ratchetFrom() throws Exception {
try (Git git = Git.init().setDirectory(rootFolder()).call()) {
- git.commit().setMessage("First commit").call();
+ git.commit().setSign(false).setMessage("First commit").call();
}
setRatchetFrom("HEAD");
testSuiteUpdateWithLatest(true);
diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java
index 52e89e58db..0723d73c0e 100644
--- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java
+++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 DiffPlug
+ * Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
import org.junit.jupiter.api.Test;
+import com.diffplug.spotless.java.GoogleJavaFormatStep;
import com.diffplug.spotless.maven.MavenIntegrationHarness;
class GoogleJavaFormatTest extends MavenIntegrationHarness {
@@ -24,7 +25,7 @@ class GoogleJavaFormatTest extends MavenIntegrationHarness {
void specificVersionDefaultStyle() throws Exception {
writePomWithJavaSteps(
"",
- " 1.17.0",
+ " " + GoogleJavaFormatStep.defaultVersion() + "",
"");
runTest("java/googlejavaformat/JavaCodeFormatted.test");
@@ -34,7 +35,7 @@ void specificVersionDefaultStyle() throws Exception {
void specificVersionSpecificStyle() throws Exception {
writePomWithJavaSteps(
"",
- " 1.17.0",
+ " " + GoogleJavaFormatStep.defaultVersion() + "",
" ",
"");
@@ -45,7 +46,7 @@ void specificVersionSpecificStyle() throws Exception {
void specificVersionReflowLongStrings() throws Exception {
writePomWithJavaSteps(
"",
- " 1.17.0",
+ " " + GoogleJavaFormatStep.defaultVersion() + "",
" true",
"");
@@ -56,7 +57,7 @@ void specificVersionReflowLongStrings() throws Exception {
void specificVersionReorderImports() throws Exception {
writePomWithJavaSteps(
"",
- " 1.17.0",
+ " " + GoogleJavaFormatStep.defaultVersion() + "",
" ",
" true",
"");
@@ -68,7 +69,7 @@ void specificVersionReorderImports() throws Exception {
void specificVersionSkipJavadocFormatting() throws Exception {
writePomWithJavaSteps(
"",
- " 1.17.0",
+ " " + GoogleJavaFormatStep.defaultVersion() + "",
" false",
"");
diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/PalantirJavaFormatTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/PalantirJavaFormatTest.java
index eee4fab8c5..ffac52c6af 100644
--- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/PalantirJavaFormatTest.java
+++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/PalantirJavaFormatTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 DiffPlug
+ * Copyright 2022-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
import org.junit.jupiter.api.Test;
+import com.diffplug.spotless.java.PalantirJavaFormatStep;
import com.diffplug.spotless.maven.MavenIntegrationHarness;
class PalantirJavaFormatTest extends MavenIntegrationHarness {
@@ -34,7 +35,7 @@ void specificVersionDefaultStyle() throws Exception {
void specificJava11Version2() throws Exception {
writePomWithJavaSteps(
"",
- " 2.39.0",
+ " " + PalantirJavaFormatStep.defaultVersion() + "",
"");
runTest("java/palantirjavaformat/JavaCodeFormatted.test", "java/palantirjavaformat/JavaCodeUnformatted.test");
@@ -44,7 +45,7 @@ void specificJava11Version2() throws Exception {
void formatJavaDoc() throws Exception {
writePomWithJavaSteps(
"",
- " 2.39.0",
+ " " + PalantirJavaFormatStep.defaultVersion() + "",
" true",
"");
diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/kotlin/DiktatTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/kotlin/DiktatTest.java
index dc6e59fef0..3978715d95 100644
--- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/kotlin/DiktatTest.java
+++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/kotlin/DiktatTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2022 DiffPlug
+ * Copyright 2021-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ void testDiktatWithVersion() throws Exception {
writePomWithKotlinSteps(
"",
- " 1.2.1",
+ " 2.0.0",
"");
String path = "src/main/kotlin/Main.kt";
@@ -56,7 +56,7 @@ void testDiktatConfig() throws Exception {
File conf = setFile(configPath).toResource("kotlin/diktat/diktat-analysis.yml");
writePomWithKotlinSteps(
"",
- " 1.2.1",
+ " 2.0.0",
" " + conf.getAbsolutePath() + "",
"");
diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java
index 78830bf09d..dd840796b7 100644
--- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java
+++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/npm/NpmTestsWithDynamicallyInstalledNpmInstallationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 DiffPlug
+ * Copyright 2023-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ public class NpmTestsWithDynamicallyInstalledNpmInstallationTest extends MavenIn
@Test
void useDownloadedNpmInstallation() throws Exception {
writePomWithPrettierSteps(
- pomPluginLines("v18.13.0", null),
+ pomPluginLines("v22.14.0", null),
"src/main/typescript/test.ts",
"",
" " + installedNpmPath() + "",
diff --git a/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java b/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java
index 4a5f8df9c2..783ca6b94e 100644
--- a/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java
+++ b/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java
@@ -325,6 +325,7 @@ void should_setFromGit_year_when_singleCommit() throws Exception {
.setMessage("add")
.setAuthor("Test User", "test@example.com")
.setCommitter("Test User", "test@example.com")
+ .setSign(false)
.call();
}
diff --git a/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java b/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java
index e9694bbd63..cae19f4bca 100644
--- a/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java
+++ b/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java
@@ -82,7 +82,7 @@ void versionBelowMinOnJava25IsNotAllowed() throws Exception {
FormatterStep step = GoogleJavaFormatStep.create("1.28.0", "AOSP", TestProvisioner.mavenCentral());
StepHarness.forStepNoRoundtrip(step)
.expectLintsOfResource("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test")
- .toBe("LINE_UNDEFINED google-java-format(jvm-version) You are running Spotless on JVM 25. This requires google-java-format of at least 1.30.0 (you are using 1.28.0). (...)");
+ .toBe("LINE_UNDEFINED google-java-format(jvm-version) You are running Spotless on JVM " + Jvm.version() + ". This requires google-java-format of at least 1.30.0 (you are using 1.28.0). (...)");
}
@Test
diff --git a/testlib/src/test/java/com/diffplug/spotless/kotlin/DiktatStepTest.java b/testlib/src/test/java/com/diffplug/spotless/kotlin/DiktatStepTest.java
index 82180045c6..6efab924ee 100644
--- a/testlib/src/test/java/com/diffplug/spotless/kotlin/DiktatStepTest.java
+++ b/testlib/src/test/java/com/diffplug/spotless/kotlin/DiktatStepTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2024 DiffPlug
+ * Copyright 2021-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,8 +42,8 @@ void behaviorConf() throws Exception {
File conf = setFile(configPath).toResource("kotlin/diktat/diktat-analysis.yml");
FileSignature config = signAsList(conf);
- FormatterStep step = DiktatStep.create("1.2.1", TestProvisioner.mavenCentral(), config);
- StepHarnessWithFile.forStep(this, step).expectLintsOfResource("kotlin/diktat/Unsolvable.kt").toBe("L1 diktat(diktat-ruleset:debug-print) [DEBUG_PRINT] use a dedicated logging library: found println()",
+ FormatterStep step = DiktatStep.create("2.0.0", TestProvisioner.mavenCentral(), config);
+ StepHarnessWithFile.forStep(this, step).expectLintsOfResource("kotlin/diktat/Unsolvable.kt").toBe("L12 diktat(diktat-ruleset:debug-print) [DEBUG_PRINT] use a dedicated logging library: found println()",
"L13 diktat(diktat-ruleset:debug-print) [DEBUG_PRINT] use a dedicated logging library: found println()");
}
diff --git a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java
index 783b5d50fe..0707a8fa09 100644
--- a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java
+++ b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java
@@ -18,6 +18,8 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledForJreRange;
+import org.junit.jupiter.api.condition.JRE;
import com.diffplug.spotless.FormatterStep;
import com.diffplug.spotless.ResourceHarness;
@@ -79,6 +81,7 @@ void behaviorWithOptions_0_56() {
}
@Test
+ @EnabledForJreRange(max = JRE.JAVA_24)
void dropboxStyle_0_16() throws Exception {
KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions();
FormatterStep step = KtfmtStep.create("0.16", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options);
@@ -86,6 +89,7 @@ void dropboxStyle_0_16() throws Exception {
}
@Test
+ @EnabledForJreRange(max = JRE.JAVA_24)
void dropboxStyle_0_18() throws Exception {
KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions();
FormatterStep step = KtfmtStep.create("0.18", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options);
@@ -93,6 +97,7 @@ void dropboxStyle_0_18() throws Exception {
}
@Test
+ @EnabledForJreRange(max = JRE.JAVA_24)
void dropboxStyle_0_22() throws Exception {
KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions();
FormatterStep step = KtfmtStep.create("0.22", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options);