Gradle 7.6 is executing tasks in a different order, with mergeClasses being run aftercompileTestJava. This results in compileTestJava failing as it can't find the module-info.class which is generated by mergeClasses.
Fix looks to be to have the compileTestJava task, i.e. JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME, depend on the mergeClasses task. Thereby ensuring mergeClasses runs first and the module-info.class is available to compileTestJava.
It is possible/likely that the JavaPlugin.TEST_TASK_NAME task, i.e. test task, no longer needs to depend on mergeClasses. However, removing it may cause problems if there are other tasks run by test that require the output of mergeClasses. Of course, those tasks may also run foul of the re-ordering happening with Gradle 7.6.
fixes: https://github.com/java9-modularity/gradle-modules-plugin/issues/258
Gradle 7.6 is executing tasks in a different order, with
mergeClasses
being run aftercompileTestJava
. This results incompileTestJava
failing as it can't find themodule-info.class
which is generated bymergeClasses
.Fix looks to be to have the
compileTestJava
task, i.e.JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME
, depend on themergeClasses
task. Thereby ensuringmergeClasses
runs first and themodule-info.class
is available tocompileTestJava
.It is possible/likely that the
JavaPlugin.TEST_TASK_NAME
task, i.e.test
task, no longer needs to depend onmergeClasses
. However, removing it may cause problems if there are other tasks run bytest
that require the output ofmergeClasses
. Of course, those tasks may also run foul of the re-ordering happening with Gradle 7.6.