openrewrite / rewrite-gradle-plugin

OpenRewrite's Gradle plugin.
Apache License 2.0
60 stars 37 forks source link

Add JavaVersion marker to files in Java project resources directories #314

Closed gideon-sunbit closed 1 month ago

gideon-sunbit commented 1 month ago

What's changed?

Add JavaVersion marker to files in Java project resources directories

What's your motivation?

For parity with the Maven plugin which adds the JavaVersion marker also to files in Java resources directories. Without this fix, for example, the EnableVirtualThreads recipe does no changes if executed via the Gradle plugin, while the Maven plugin performs the expected changes:

Maven Plugin:

[INFO] --- rewrite:5.36.0:run (default-cli) @ java-version-marker ---
[INFO] Using active recipe(s) [org.openrewrite.java.spring.boot3.EnableVirtualThreads]
[INFO] Using active styles(s) []
[INFO] Validating active recipes...
[INFO] Project [java-version-marker] Resolving Poms...
[INFO] Project [java-version-marker] Parsing source files
[INFO] Running recipe(s)...
[INFO] Printing Available Datatables to: target/rewrite/datatables/2024-07-29_19-05-16-717
[WARNING] Changes have been made to java-version-marker/src/main/resources/application.properties by:
[WARNING]     org.openrewrite.java.spring.boot3.EnableVirtualThreads
[WARNING]         org.openrewrite.java.spring.AddSpringProperty: {property=spring.threads.virtual.enabled, value=true}
[WARNING] Please review and commit the results.
[WARNING] Estimate time saved: 5m

Gradle Plugin:

> Task :rewriteRun
Validating active recipes
Scanning sources in project :
Using active styles []
All sources parsed, running active recipes: org.openrewrite.java.spring.boot3.EnableVirtualThreads

BUILD SUCCESSFUL in 3s

Example project: https://github.com/gideon-sunbit/openrewrite-examples-public/tree/main/java-version-marker

Checklist