Skip to content

Add Kotlin DSL (init.gradle.kts) support for Gradle init scripts#482

Merged
timtebeek merged 2 commits intomasterfrom
tim/gradle-kts-no-build-change
Apr 9, 2026
Merged

Add Kotlin DSL (init.gradle.kts) support for Gradle init scripts#482
timtebeek merged 2 commits intomasterfrom
tim/gradle-kts-no-build-change

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Apr 9, 2026

Summary

  • Adds Kotlin DSL tabs alongside the existing Groovy init script in the RunRecipe component (new "Gradle init script (Kotlin)" tab)

  • Adds Groovy/Kotlin tabbed code blocks to the standalone "Running Rewrite on a Gradle project without modifying the build" guide

  • Kotlin differences: uri(...) for maven URL, ::class.java for plugin apply, extensions.configure<RewriteExtension> for the rewrite block

  • Closes Running Rewrite on a Gradle Kotlin project without modifying the build #234

Adds a Kotlin DSL variant alongside the existing Groovy init script in
both the RunRecipe component and the standalone guide page.

Closes #234
In Kotlin DSL init scripts, the `rewrite` configuration created by the
plugin isn't available as a typed accessor. Use `add("rewrite", ...)`
instead, which was verified against spring-petclinic.
@timtebeek timtebeek marked this pull request as ready for review April 9, 2026 18:39
@timtebeek timtebeek requested a review from mike-solomon April 9, 2026 18:39
@timtebeek timtebeek added the documentation Improvements or additions to documentation label Apr 9, 2026
Copy link
Copy Markdown
Contributor

@mike-solomon mike-solomon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Apr 9, 2026
@timtebeek timtebeek merged commit d80df3f into master Apr 9, 2026
2 checks passed
@timtebeek timtebeek deleted the tim/gradle-kts-no-build-change branch April 9, 2026 19:13
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Running Rewrite on a Gradle Kotlin project without modifying the build

2 participants