Skip to content

Migrate 'main' property in MigrateToGradle9#7504

Merged
timtebeek merged 3 commits intoopenrewrite:mainfrom
sullis:sullis/MigrateToGradle9-enhance
Apr 28, 2026
Merged

Migrate 'main' property in MigrateToGradle9#7504
timtebeek merged 3 commits intoopenrewrite:mainfrom
sullis:sullis/MigrateToGradle9-enhance

Conversation

@sullis
Copy link
Copy Markdown
Contributor

@sullis sullis commented Apr 28, 2026

What's changed?

migrate JavaExec 'main' in the Gradle 9 migration recipe

Reference docs

https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html

https://docs.gradle.org/9.0.0/userguide/upgrading_major_version_9.html

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Apr 28, 2026
@sullis sullis marked this pull request as draft April 28, 2026 15:55
@sullis sullis force-pushed the sullis/MigrateToGradle9-enhance branch from fbcef65 to 0b31ae2 Compare April 28, 2026 16:09
@sullis sullis force-pushed the sullis/MigrateToGradle9-enhance branch from 0b31ae2 to e87fcc8 Compare April 28, 2026 16:15
@sullis sullis marked this pull request as ready for review April 28, 2026 16:16
Detect `tasks.register<JavaExec>("name")` via `getTypeParameters()` so the
recipe also rewrites `main` to `mainClass` in `.gradle.kts` files. Reorder
the `visitAssignment` checks so the cheap `instanceof` and simple-name
checks run before the cursor-message lookup.
@sullis
Copy link
Copy Markdown
Contributor Author

sullis commented Apr 28, 2026

LGTM

…scription

Matches the pattern used in JacocoReportDeprecations.
Copy link
Copy Markdown
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Great addition, thanks!

@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Apr 28, 2026
@timtebeek timtebeek merged commit 86bec62 into openrewrite:main Apr 28, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants