Reproduces the "Cannot use shouldRunAfter to reference tasks from another build" issue encountered when using the Avast Gradle Docker Compose Plugin in a Gradle project that uses composite builds.
Building this project will run a wiremock server in docker compose and then run a test that hits an endpoint.
To reproduce the issue, run ./gradlew test
from the root of the project. The test will fail with the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Cannot use shouldRunAfter to reference tasks from another build.
This issue seems to be caused by a combination of:
- the changes introduced in #356 (using
shouldRunAfter task.taskDependencies
inisRequiredBy()
) - Gradle 8 making it an error to reference tasks in an included build with
shouldRunAfter
To work around the issue, you can set up the task dependencies manually and filter out tasks from included builds instead of using shouldRunAfter task.taskDependencies
,
as is done in my-project/build.gradle.kts
.
You can see this workaround in action by running ./gradlew test -PenableWorkaround=true
from the root of the project.