Error after upgrading gradle 5.2 to 8.8

Hi I am getting below error while building project. Can anyone help me with resolving issue

uses this output of task ‘:test:yarnBuild’ without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

Thanks in advance

That means that you build most probably always was broken, or at least unreliable or flaky, but Gradle 7 added some recognition that warned you about the situation and Gradle 8 promoted the warning to an error.

Generally, for a smooth upgrade experience, I recommend to

  • upgrade to the latest patch release within the same major version
  • upgrade all plugins as far as compatible
  • fix all deprecation warnings
  • upgrade to the latest patch release within the directly following major version, considering upgrade notes in the userguide
  • back to second step until being on the target version

The error you got can have various reasons and the suggested resolutions are most often a very sub-optimal symptom treatment instead of a proper fix.

Most typically reasons are either that tasks have overlapping outputs, so that task A declares output directory build/foo and task B declares output directory build/foo/bar, then task C has the output of A as input. When executed Gradle sees that C has outputs of B as inputs due to the overlapping outputs but does not have a dependency or ordering constraint on B.
The proper solution here would for example be to make A and B not having overlapping outputs.

Another typical reason is, that task outputs and inputs are not properly wired together. For example by configuring the output path of a task as input for another task instead of properly wiring the task outputs to the task inputs.
In that case the proper solution would be to not manually configure paths, but properly wiring the tasks together.