Skip to content

Task ':reportTestScoverage' uses this output of task ':installDist' without declaring an explicit or implicit dependency #190

Open
@dsilvasc

Description

@dsilvasc

I just noticed an issue similar to #163

When I have a project with both the scoverage plugin and the application plugin, and I run this:

./gradlew installDist reportTestScoverage

Then the build fails with:

Some problems were found with the configuration of task ':reportTestScoverage' (type 'ScoverageReport').
  - Gradle detected a problem with the following location: '/Users/dsilva/src/example-project'.

    Reason: Task ':reportTestScoverage' uses this output of task ':installDist' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending   on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':installDist' as an input of ':reportTestScoverage'.
      2. Declare an explicit dependency on ':installDist' from ':reportTestScoverage' using Task#dependsOn.
      3. Declare an explicit dependency on ':installDist' from ':reportTestScoverage' using Task#mustRunAfter.

    Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: '/Users/dsilva/src/example-project'.

    Reason: Task ':reportTestScoverage' uses this output of task ':startScripts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending  on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':startScripts' as an input of ':reportTestScoverage'.
      2. Declare an explicit dependency on ':startScripts' from ':reportTestScoverage' using Task#dependsOn.
      3. Declare an explicit dependency on ':startScripts' from ':reportTestScoverage' using Task#mustRunAfter.

    Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.

I'm working around it with what the error message suggested:

tasks.withType<org.scoverage.ScoverageReport>().configureEach {
  try {
    val installDist = tasks.named("installDist")
    mustRunAfter(installDist)
  } catch (e: UnknownTaskException) {}
  try {
    val startScripts = tasks.named("startScripts")
    mustRunAfter(startScripts)
  } catch (e: UnknownTaskException) {}
}

but it seems like the scoverage plugin might be using the project root dir unnecessarily?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions