diff --git a/CHANGES.md b/CHANGES.md
index c1f915ed42..f3a8ba11de 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -10,6 +10,10 @@ This document is intended for Spotless developers.
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).
## [Unreleased]
+### Added
+- Add `tableTest` format type for standalone `.table` files.
+### Changes
+- Bump default `tabletest-formatter` version `1.0.1` -> `1.1.0`, now works with Java 17+.
## [4.4.0] - 2026-03-02
### Added
diff --git a/lib/build.gradle b/lib/build.gradle
index 75e3c017ed..170b4beb95 100644
--- a/lib/build.gradle
+++ b/lib/build.gradle
@@ -24,12 +24,9 @@ def NEEDS_GLUE = [
'palantirJavaFormat',
'scalafmt',
'sortPom',
+ 'tableTestFormatter',
'zjsonPatch',
]
-// tableTestFormatter requires Java 21+
-if (JavaVersion.current() >= JavaVersion.VERSION_21) {
- NEEDS_GLUE << 'tableTestFormatter'
-}
for (glue in NEEDS_GLUE) {
sourceSets.register(glue) {
@@ -127,10 +124,8 @@ dependencies {
// sortPom
sortPomCompileOnly 'com.github.ekryd.sortpom:sortpom-sorter:4.0.0'
sortPomCompileOnly 'org.slf4j:slf4j-api:2.0.17'
- // tableTestFormatter (Java 21+ only)
- if (JavaVersion.current() >= JavaVersion.VERSION_21) {
- tableTestFormatterCompileOnly 'org.tabletest:tabletest-formatter-core:1.0.1'
- }
+ // tableTestFormatter
+ tableTestFormatterCompileOnly 'org.tabletest:tabletest-formatter-core:1.1.0'
// zjsonPatch
zjsonPatchCompileOnly 'com.flipkart.zjsonpatch:zjsonpatch:0.4.16'
}
diff --git a/lib/src/main/java/com/diffplug/spotless/java/TableTestFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/java/TableTestFormatterStep.java
index b55f0a9405..f685823c76 100644
--- a/lib/src/main/java/com/diffplug/spotless/java/TableTestFormatterStep.java
+++ b/lib/src/main/java/com/diffplug/spotless/java/TableTestFormatterStep.java
@@ -34,7 +34,7 @@ public final class TableTestFormatterStep implements Serializable {
private static final long serialVersionUID = 1L;
private static final String NAME = "tableTestFormatter";
private static final String MAVEN_COORDINATE = "org.tabletest:tabletest-formatter-core:";
- private static final String DEFAULT_VERSION = "1.0.1";
+ private static final String DEFAULT_VERSION = "1.1.0";
private final JarState.Promised jarState;
private final String version;
diff --git a/lib/src/tableTestFormatter/java/com/diffplug/spotless/glue/java/TableTestFormatterFunc.java b/lib/src/tableTestFormatter/java/com/diffplug/spotless/glue/java/TableTestFormatterFunc.java
index 35261d5398..935cfe2a59 100644
--- a/lib/src/tableTestFormatter/java/com/diffplug/spotless/glue/java/TableTestFormatterFunc.java
+++ b/lib/src/tableTestFormatter/java/com/diffplug/spotless/glue/java/TableTestFormatterFunc.java
@@ -20,17 +20,19 @@
import org.tabletest.formatter.config.Config;
import org.tabletest.formatter.config.EditorConfigProvider;
import org.tabletest.formatter.core.SourceFileFormatter;
+import org.tabletest.formatter.core.TableTestFormatter;
import com.diffplug.spotless.FormatterFunc;
/**
- * Formats {@code @TableTest} annotation tables in Java and Kotlin source files.
+ * Formats {@code @TableTest} annotation tables in Java, Kotlin, and standalone {@code .table} files.
*/
public class TableTestFormatterFunc implements FormatterFunc.NeedsFile {
private static final EditorConfigProvider CONFIG_PROVIDER = new EditorConfigProvider();
private final SourceFileFormatter sourceFormatter = new SourceFileFormatter();
+ private final TableTestFormatter tableFormatter = new TableTestFormatter();
@Override
public String applyWithFile(String unix, File file) throws Exception {
@@ -42,6 +44,11 @@ public String applyWithFile(String unix, File file) throws Exception {
return formatted.equals(unix) ? unix : formatted;
}
+ if (fileName.endsWith(".table")) {
+ String formatted = tableFormatter.format(unix, "", Config.NO_INDENT);
+ return formatted.equals(unix) ? unix : formatted;
+ }
+
return unix;
}
}
diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md
index e0a61cf180..3d181fa2fb 100644
--- a/plugin-gradle/CHANGES.md
+++ b/plugin-gradle/CHANGES.md
@@ -3,6 +3,10 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).
## [Unreleased]
+### Added
+- Add `tableTest` format type for standalone `.table` files.
+### Changes
+- Bump default `tabletest-formatter` version `1.0.1` -> `1.1.0`, now works with Java 17+.
## [8.3.0] - 2026-03-02
### Added
diff --git a/plugin-gradle/README.md b/plugin-gradle/README.md
index 8823d89c11..4f20d26dc9 100644
--- a/plugin-gradle/README.md
+++ b/plugin-gradle/README.md
@@ -439,7 +439,7 @@ spotless {
java {
tableTestFormatter()
// optional: you can specify a specific version
- tableTestFormatter('1.0.1')
+ tableTestFormatter('1.1.0')
```
@@ -616,7 +616,7 @@ spotless {
kotlin {
tableTestFormatter()
// optional: you can specify a specific version
- tableTestFormatter('1.0.1')
+ tableTestFormatter('1.1.0')
```
@@ -1265,6 +1265,34 @@ shfmt().pathToExe('/opt/homebrew/bin/shfmt')
+## TableTest
+
+- `com.diffplug.gradle.spotless.TableTestExtension` [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TableTestExtension.java)
+
+```gradle
+spotless {
+ tableTest {
+ target 'src/**/*.table' // you have to set the target manually
+ tableTestFormatter() // has its own section below
+ }
+}
+```
+
+### tabletest-formatter
+
+[homepage](https://github.com/nchaugen/tabletest-formatter). [changelog](https://github.com/nchaugen/tabletest-formatter/releases). Formats standalone [TableTest](https://github.com/nchaugen/tabletest) `.table` files.
+
+```gradle
+spotless {
+ tableTest {
+ target 'src/**/*.table'
+ tableTestFormatter()
+ // optional: you can specify a specific version
+ tableTestFormatter('1.1.0')
+ }
+}
+```
+
## Gherkin
- `com.diffplug.gradle.spotless.GherkinExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/8.3.0/com/diffplug/gradle/spotless/GherkinExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GherkinExtension.java)
diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtension.java
index c41b28c331..26e91eba8c 100644
--- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtension.java
+++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessExtension.java
@@ -183,6 +183,12 @@ public void javascript(Action closure) {
format(JavascriptExtension.NAME, JavascriptExtension.class, closure);
}
+ /** Configures the special tableTest-specific extension for .table files. */
+ public void tableTest(Action closure) {
+ requireNonNull(closure);
+ format(TableTestExtension.NAME, TableTestExtension.class, closure);
+ }
+
/** Configures the special typescript-specific extension for typescript files. */
public void typescript(Action closure) {
format(TypescriptExtension.NAME, TypescriptExtension.class, closure);
diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TableTestExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TableTestExtension.java
new file mode 100644
index 0000000000..22d2c75d60
--- /dev/null
+++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TableTestExtension.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2026 DiffPlug
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.diffplug.gradle.spotless;
+
+import javax.inject.Inject;
+
+import com.diffplug.spotless.FormatterStep;
+import com.diffplug.spotless.java.TableTestFormatterStep;
+
+public class TableTestExtension extends FormatExtension {
+ static final String NAME = "tableTest";
+
+ @Inject
+ public TableTestExtension(SpotlessExtension spotless) {
+ super(spotless);
+ }
+
+ @Override
+ protected void setupTask(SpotlessTask task) {
+ if (target == null) {
+ throw noDefaultTargetException();
+ }
+ super.setupTask(task);
+ }
+
+ public TableTestFormatterConfig tableTestFormatter() {
+ return tableTestFormatter(TableTestFormatterStep.defaultVersion());
+ }
+
+ public TableTestFormatterConfig tableTestFormatter(String version) {
+ return new TableTestFormatterConfig(version);
+ }
+
+ public class TableTestFormatterConfig {
+ private final String version;
+
+ TableTestFormatterConfig(String version) {
+ this.version = version;
+ addStep(createStep());
+ }
+
+ private FormatterStep createStep() {
+ return TableTestFormatterStep.create(version, provisioner());
+ }
+ }
+}
diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TableTestExtensionTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TableTestExtensionTest.java
new file mode 100644
index 0000000000..3e24ab4a84
--- /dev/null
+++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TableTestExtensionTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2026 DiffPlug
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.diffplug.gradle.spotless;
+
+import java.io.IOException;
+
+import org.junit.jupiter.api.Test;
+
+public class TableTestExtensionTest extends GradleIntegrationHarness {
+ @Test
+ public void defaultFormatting() throws IOException {
+ setFile("build.gradle").toLines(
+ "plugins {",
+ " id 'java'",
+ " id 'com.diffplug.spotless'",
+ "}",
+ "repositories { mavenCentral() }",
+ "spotless {",
+ " tableTest {",
+ " target 'src/**/*.table'",
+ " tableTestFormatter()",
+ " }",
+ "}");
+ setFile("src/main/resources/example.table").toResource("tableTest/tableFileUnformatted.test");
+ setFile("other/example.table").toResource("tableTest/tableFileUnformatted.test");
+ gradleRunner().withArguments("spotlessApply").build();
+ assertFile("src/main/resources/example.table").sameAsResource("tableTest/tableFileFormatted.test");
+ assertFile("other/example.table").sameAsResource("tableTest/tableFileUnformatted.test");
+ }
+}
diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md
index a34db2ab7e..4ccd4862ea 100644
--- a/plugin-maven/CHANGES.md
+++ b/plugin-maven/CHANGES.md
@@ -3,6 +3,10 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).
## [Unreleased]
+### Added
+- Add `tableTest` format type for standalone `.table` files.
+### Changes
+- Bump default `tabletest-formatter` version `1.0.1` -> `1.1.0`, now works with Java 17+.
## [3.3.0] - 2026-03-02
### Added
diff --git a/plugin-maven/README.md b/plugin-maven/README.md
index dc91861ab1..2481efe54a 100644
--- a/plugin-maven/README.md
+++ b/plugin-maven/README.md
@@ -407,7 +407,7 @@ These mechanisms already exist for the Gradle plugin.
```xml
- 1.0.1
+ 1.1.0
```
@@ -543,7 +543,7 @@ Additionally, `editorConfigOverride` options will override what's supplied in `.
```xml
- 1.0.1
+ 1.1.0
```
@@ -1190,6 +1190,25 @@ When formatting shell scripts via `shfmt`, configure `shfmt` settings via `.edit
```
+## TableTest
+
+[code](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest/TableTest.java). [available steps](https://github.com/diffplug/spotless/tree/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest).
+
+```xml
+
+
+
+ src/**/*.table
+
+
+ 1.1.0
+
+
+
+```
+
+[homepage](https://github.com/nchaugen/tabletest-formatter). [changelog](https://github.com/nchaugen/tabletest-formatter/releases). Formats standalone [TableTest](https://github.com/nchaugen/tabletest) `.table` files.
+
## Gherkin
- `com.diffplug.spotless.maven.FormatterFactory.addStepFactory(FormatterStepFactory)` [code](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/gherkin/Gherkin.java)
diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java
index 84b980ab5e..26c3e602c4 100644
--- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java
+++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java
@@ -82,6 +82,7 @@
import com.diffplug.spotless.maven.scala.Scala;
import com.diffplug.spotless.maven.shell.Shell;
import com.diffplug.spotless.maven.sql.Sql;
+import com.diffplug.spotless.maven.tabletest.TableTest;
import com.diffplug.spotless.maven.typescript.Typescript;
import com.diffplug.spotless.maven.yaml.Yaml;
@@ -208,6 +209,9 @@ public abstract class AbstractSpotlessMojo extends AbstractMojo {
@Parameter
private Protobuf protobuf;
+ @Parameter
+ private TableTest tableTest;
+
@Parameter(property = "spotlessFiles")
private String filePatterns;
@@ -410,7 +414,7 @@ private FileLocator getFileLocator() {
}
private List getFormatterFactories() {
- return Stream.concat(formats.stream(), Stream.of(groovy, java, scala, kotlin, cpp, css, typescript, javascript, antlr4, pom, sql, python, markdown, json, shell, yaml, gherkin, go, rdf, protobuf))
+ return Stream.concat(formats.stream(), Stream.of(groovy, java, scala, kotlin, cpp, css, typescript, javascript, antlr4, pom, sql, python, markdown, json, shell, yaml, gherkin, go, rdf, protobuf, tableTest))
.filter(Objects::nonNull)
.map(factory -> factory.init(repositorySystemSession))
.collect(toList());
diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest/TableTest.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest/TableTest.java
new file mode 100644
index 0000000000..8eaa971758
--- /dev/null
+++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest/TableTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2026 DiffPlug
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.diffplug.spotless.maven.tabletest;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.maven.project.MavenProject;
+
+import com.diffplug.spotless.maven.FormatterFactory;
+
+/**
+ * A {@link FormatterFactory} implementation that corresponds to {@code ...} configuration element.
+ */
+public class TableTest extends FormatterFactory {
+ @Override
+ public Set defaultIncludes(MavenProject project) {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public String licenseHeaderDelimiter() {
+ return null;
+ }
+
+ public void addTableTestFormatter(TableTestFormatter tableTestFormatter) {
+ addStepFactory(tableTestFormatter);
+ }
+}
diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest/TableTestFormatter.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest/TableTestFormatter.java
new file mode 100644
index 0000000000..64caf057c2
--- /dev/null
+++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/tabletest/TableTestFormatter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2026 DiffPlug
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.diffplug.spotless.maven.tabletest;
+
+import org.apache.maven.plugins.annotations.Parameter;
+
+import com.diffplug.spotless.FormatterStep;
+import com.diffplug.spotless.java.TableTestFormatterStep;
+import com.diffplug.spotless.maven.FormatterStepConfig;
+import com.diffplug.spotless.maven.FormatterStepFactory;
+
+/**
+ * Formats standalone {@code .table} files. Configuration is read from {@code .editorconfig} files.
+ */
+public class TableTestFormatter implements FormatterStepFactory {
+
+ @Parameter
+ private String version;
+
+ @Override
+ public FormatterStep newFormatterStep(FormatterStepConfig config) {
+ String version = this.version != null ? this.version : TableTestFormatterStep.defaultVersion();
+ return TableTestFormatterStep.create(version, config.getProvisioner());
+ }
+}
diff --git a/testlib/src/main/resources/tableTest/tableFileFormatted.test b/testlib/src/main/resources/tableTest/tableFileFormatted.test
new file mode 100644
index 0000000000..4fd1542317
--- /dev/null
+++ b/testlib/src/main/resources/tableTest/tableFileFormatted.test
@@ -0,0 +1,3 @@
+name | age | city
+Alice | 30 | London
+Bob | 25 | Manchester
diff --git a/testlib/src/main/resources/tableTest/tableFileUnformatted.test b/testlib/src/main/resources/tableTest/tableFileUnformatted.test
new file mode 100644
index 0000000000..85823c967a
--- /dev/null
+++ b/testlib/src/main/resources/tableTest/tableFileUnformatted.test
@@ -0,0 +1,3 @@
+name|age|city
+Alice|30|London
+Bob|25|Manchester
diff --git a/testlib/src/test/java/com/diffplug/spotless/java/TableTestFormatterStepTest.java b/testlib/src/test/java/com/diffplug/spotless/java/TableTestFormatterStepTest.java
index 787c1a26fb..7d6e6981ce 100644
--- a/testlib/src/test/java/com/diffplug/spotless/java/TableTestFormatterStepTest.java
+++ b/testlib/src/test/java/com/diffplug/spotless/java/TableTestFormatterStepTest.java
@@ -15,10 +15,7 @@
*/
package com.diffplug.spotless.java;
-import static org.junit.jupiter.api.condition.JRE.JAVA_21;
-
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledForJreRange;
import com.diffplug.spotless.FormatterStep;
import com.diffplug.spotless.ResourceHarness;
@@ -28,10 +25,9 @@
class TableTestFormatterStepTest extends ResourceHarness {
- private static final String VERSION = "1.0.1";
+ private static final String VERSION = "1.1.0";
@Test
- @EnabledForJreRange(min = JAVA_21)
void behavior() {
FormatterStep step = TableTestFormatterStep.create(VERSION, TestProvisioner.mavenCentral());
try (StepHarnessWithFile harness = StepHarnessWithFile.forStep(this, step)) {
@@ -40,7 +36,14 @@ void behavior() {
}
@Test
- @EnabledForJreRange(min = JAVA_21)
+ void behaviorTableFile() {
+ FormatterStep step = TableTestFormatterStep.create(VERSION, TestProvisioner.mavenCentral());
+ try (StepHarnessWithFile harness = StepHarnessWithFile.forStep(this, step)) {
+ harness.testResource("example.table", "tableTest/tableFileUnformatted.test", "tableTest/tableFileFormatted.test");
+ }
+ }
+
+ @Test
void equality() {
new SerializableEqualityTester() {
String version = VERSION;