Problem
The versionCatalog step's maxLineLength feature splits long inline tables across multiple lines when they exceed the configured limit.
This produces TOML 1.1 multi-line inline table syntax, which Gradle's version catalog parser (TOML 1.0) cannot read.
After running spotlessApply, the next Gradle build fails with parse errors like:
Unexpected end of line, expected a-z, A-Z, 0-9, }, ', or "
Steps to Reproduce
-
Add a versionCatalog step with maxLineLength (default is 120):
spotless {
toml {
target("gradle/libs.versions.toml")
versionCatalog()
}
}
-
Have an entry in libs.versions.toml that exceeds 120 characters:
[libraries]
asciidoctor-block-switch = { module = "io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch", version = "0.6.3" }
-
Run ./gradlew spotlessApply. The entry is split to:
asciidoctor-block-switch = {
module = "io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch",
version = "0.6.3",
}
-
The next ./gradlew invocation fails because Gradle's TOML parser does not support multi-line inline tables.
The formatter itself is idempotent — it can parse its own multi-line output back. But Gradle cannot, making the file unusable after formatting.
Expected Behavior
The versionCatalog step should not produce output that Gradle's version catalog parser cannot read. Long lines should be left as-is, since Gradle requires inline tables on a single line.
Workaround
Disable line splitting by setting maxLineLength to 0:
spotless {
toml {
target("gradle/libs.versions.toml")
versionCatalog().maxLineLength(0)
}
}
Environment
- Spotless: 8.5.1
- Gradle: 9.5.1
- JDK: 21
Problem
The
versionCatalogstep'smaxLineLengthfeature splits long inline tables across multiple lines when they exceed the configured limit.This produces TOML 1.1 multi-line inline table syntax, which Gradle's version catalog parser (TOML 1.0) cannot read.
After running
spotlessApply, the next Gradle build fails with parse errors like:Steps to Reproduce
Add a
versionCatalogstep withmaxLineLength(default is 120):spotless { toml { target("gradle/libs.versions.toml") versionCatalog() } }Have an entry in
libs.versions.tomlthat exceeds 120 characters:Run
./gradlew spotlessApply. The entry is split to:The next
./gradlewinvocation fails because Gradle's TOML parser does not support multi-line inline tables.The formatter itself is idempotent — it can parse its own multi-line output back. But Gradle cannot, making the file unusable after formatting.
Expected Behavior
The
versionCatalogstep should not produce output that Gradle's version catalog parser cannot read. Long lines should be left as-is, since Gradle requires inline tables on a single line.Workaround
Disable line splitting by setting
maxLineLengthto 0:spotless { toml { target("gradle/libs.versions.toml") versionCatalog().maxLineLength(0) } }Environment