Skip to content

Issue when code coverage involved #111

@brianchu

Description

@brianchu

Problem
In our project, we use dependency-guard to enforce dependency consistency between local development and CI. However, we’ve encountered an issue due to differing code coverage setups:

Local Development:
Developers typically disable code coverage (e.g., testCoverageEnabled = false in Gradle for Android projects), so JaCoCo dependencies (like org.jacoco:org.jacoco.agent) aren’t included in the resolved dependency set. When we generate the baseline with ./gradlew dependencyGuardBaseline, the resulting file excludes JaCoCo, as expected.

CI Environment: CI pipeline enables code coverage (testCoverageEnabled = true) for builds like debug or qa. This adds JaCoCo dependencies to the runtime classpath. When CI runs ./gradlew dependencyGuard, it detects these extra JaCoCo dependencies, which aren’t in the checked-in baseline, causing the task to fail with a dependency mismatch error.

What can we do in this case?

Can we add a filter to ignore certain package? so in non CI env, I can skip that package.

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