GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TOML: dedicated plugin to format and sort libs.versions.toml files in Gradle projects · Issue #2916 · diffplug/spotless

TOML: dedicated plugin to format and sort libs.versions.toml files in Gradle projects #2916

New issue
Copy link
New issue
Copy link
Closed
#2917
Closed
TOML: dedicated plugin to format and sort libs.versions.toml files in Gradle projects#2916
#2917
Copy link

Description

@mkutz
mkutz
opened on May 4, 2026
Issue body actions

I'd like to have a layout step that formates and also sorts TOML files.

  • proper spacing around special characters
    E.g. kotlin-jvm={id="org.jetbrains.kotlin.jvm",version="2.3.21"} → kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.3.21" } or assertj="3.27.7" → assertj = "3.27.7"
  • line breaks for long definitions
  • sort standard version catalog tables:
    1. [versions]
    2. [libraries]
    3. [bundles]
    4. [plugins]
  • sort table entries alphabetically simply by line, hence the chose alias will determine the order

Example

Unformatted:

[versions]
assertj="3.27.7"
testcontainers= "2.0.5"
junit ="6.0.3"

[libraries]
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api" }
junit-jupiter-engine = {module = "org.junit.jupiter:junit-jupiter-engine"}
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
assertj-core = { module = "org.assertj:assertj-core", version.ref="assertj" }
testcontainers-junit-jupiter= { module = "org.testcontainers:testcontainers-junit-jupiter", version.ref = "testcontainers" }
testcontainers-postgresql ={ module = "org.testcontainers:testcontainers-postgresql", version.ref = "testcontainers" }

[plugins]
sonar = { id = "org.sonarqube", version= "7.3.0.8198" }
spotless = { id = "com.diffplug.spotless", version= "7.2.1" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.3.21" }

[bundles]
junit = ["junit-jupiter-api","junit-jupiter-params"]

Formatted:

[versions]
assertj = "3.27.7"
junit = "6.0.3"
testcontainers = "2.0.5"

[libraries]
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
testcontainers-junit-jupiter = { module = "org.testcontainers:testcontainers-junit-jupiter", version.ref = "testcontainers" }
testcontainers-postgresql = { module = "org.testcontainers:testcontainers-postgresql", version.ref = "testcontainers" }

[bundles]
junit = [ "junit-jupiter-api", "junit-jupiter-params" ]

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.3.21" }
sonar = { id = "org.sonarqube", version = "7.3.0.8198" }
spotless = { id = "com.diffplug.spotless", version = "7.2.1" }

I'd be happy to provide a PR for this. I already have a general proof of concept implemented as a custom step... needs some more work, though.

Activity

  1. nedtwigg
    closed this as completedin #2917on May 14, 2026
  2. nedtwigg
    added a commit that references this issue on May 14, 2026

    Add TOML version catalog formatter step (#2916)

    f57a102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.