Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dsilvasc opened this issue Feb 23, 2023 · 0 comments

Comments

@dsilvasc
Copy link

dsilvasc commented Feb 23, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant