0

The source code is here: https://github.com/yvasyliev/telegram-forwarder-bot/tree/feature/multimodule

I have a Gradle multi module project. The sub-modules are:

  • telegram-forwarder-bot (a console application)
  • telegram-forwarder-starter (library)
  • telegram-forwarder-starter-logging (library)
  • telegram-forwarder-starter-reddit (library)
  • telegram-forwarder-starter-thymeleaf (library)

jacoco plugin is applied to all sub modules and JaCoCo report generation works as expected in each submodule.

Now I want to aggregate JaCoCo reports from submodules in a single report.

I applied jacoco-report-aggregation plugin and added the following code to the root build.gradle:

plugins {
    id 'jacoco-report-aggregation'
}

dependencies {
    jacocoAggregation project(':telegram-forwarder-bot')
}

reporting {
    reports {
        testCodeCoverageReport(JacocoCoverageReport) {
            testSuiteName = "test"
        }
    }
}

When I try to execute ./gradlew testCodeCoverageReport, I'm getting the following error:

[Incubating] Problems report is available at: file:///C:/Users/Yevhen/IdeaProjects/reddit-telegram-forwarder/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':testCodeCoverageReport'.
> Could not resolve all dependencies for configuration ':aggregateCodeCoverageReportResults'.
   > Could not resolve project :telegram-forwarder-bot.
     Required by:
         root project :
      > Unable to find a matching variant of root project ::
          - No variants exist.

* Try:
> Creating consumable variants is explained in more detail at https://docs.gradle.org/8.14.3/userguide/declaring_dependencies.html#sec:resolvable-consumable-configs.
> Review the variant matching algorithm at https://docs.gradle.org/8.14.3/userguide/variant_attributes.html#sec:abm_algorithm.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 3s

Could you please help me to make jacoco-report-aggregation plugin work?

1 Answer 1

0

Most likely I was getting this error because the root module and a submodule shared the same name. When I changed the root module name I was able to aggregate jacoco report.

Related: Projects with same name lead to unintended conflict resolution #847

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.