Skip to content

Reproduces the "Cannot use shouldRunAfter to reference tasks from another build" issue

Notifications You must be signed in to change notification settings

jamesbassett/compose-plugin-reproducer

Repository files navigation

compose-plugin-reproducer

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.

How to Reproduce

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.

Root Cause

This issue seems to be caused by a combination of:

  • the changes introduced in #356 (using shouldRunAfter task.taskDependencies in isRequiredBy())
  • Gradle 8 making it an error to reference tasks in an included build with shouldRunAfter

Workaround

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.

About

Reproduces the "Cannot use shouldRunAfter to reference tasks from another build" issue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages