Open thaitangluc2412 opened 1 month ago
Hi @thaitangluc2412 ; thanks for the detailed report; no idea what might go into that not working as expected. As a workaround you might be able to run rewrite recipes exclusively through an init script instead of adding the plugin to your build.gradle file.
What I suspect is the issue is this little block of code: https://github.com/openrewrite/rewrite-gradle-plugin/blob/main/plugin%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenrewrite%2Fgradle%2FRewritePlugin.java#L122-L138
In particular, your test
and integrationTest
source sets are both pointing to the source folder src/test/java
. If you were to run build
, you should actually see your test run twice with each task based upon the configuration that you've shared here.
With the jvm-test-suite
plugin, Gradle intends for you to use a different folder for each test suite (ie. src/integrationTest/java
) normally. Due to the clash, the OpenRewrite plugin disabled the integration test compile task which then means the outputs from that are not available for the test task resulting in a successful build.
To expand upon Tim's earlier workaround, you either need to:
NOTE: I do find it a little weird that the OpenRewrite Gradle plugin is disabling other stuff during it's configuration phase. I know why it's doing it, but doing so results in weird issues such as this one.
Description When I use the jvm-test-suite plugin simulation with OpenRewrite, the configuration of the testing suite sources does not work, so no tests can run.
Basic project![Screenshot 2024-06-05 at 16 33 10](https://github.com/openrewrite/rewrite-gradle-plugin/assets/67372806/db6ced05-4567-43d5-b3c9-471ecf35344e)
build.gradle file
Steps to Reproduce
When I use two plugins,
jvm-test-suite
andjava
, and run integrationTest with the command./gradlew integrationTest
, it executes the test in the BasicTests class and shows the failed test results because the tests in BasicTests always fail. However, when I uncomment the OpenRewrite plugin in the build.gradle file and run the./gradlew integrationTest
command again, it does nothing and showsBuild Successful
, which means no tests were executed.Screenshots
Environment
Openrewrite version: 6.15.1 Gradle version: 8.7 Java version: 17 junit-jupiter version: 5.10.2
Additional Context I downgraded the OpenRewrite version to 5.7.0, but the problem remains the same