CAMEL-23274: Enable JaCoCo coverage in SonarCloud PR analysis#22468
Merged
Conversation
The SonarCloud PR analysis always reported 0% coverage because the sonar-build workflow built with -Dquickly (skipping all tests) and never activated the coverage profile. Add a second Maven step that runs core module tests with -Dcoverage, then generates the aggregated JaCoCo report via the coverage module. All core source modules are included in the reactor so report-aggregate can map execution data from camel-core tests to their classes. Also add ContextValueFactory to the JaCoCo multi-release JAR excludes in coverage/pom.xml (same issue as the existing CamelThreadFactory exclude). Tested locally: produces a 12 MB aggregated report with ~63% line coverage across 2452 classes in 13 core modules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
2 tasks
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



CAMEL-23274
Summary
sonar-build.ymlbuilt with-Dquickly(skipping all tests) and never activated the-Dcoverageprofilesonar-build.ymlthat runs core module tests with-Dcoverageand generates the aggregated JaCoCo report via thecoveragemodulereport-aggregatecan map execution data fromcamel-coretests to their classes (~2452 classes across 13 modules)ContextValueFactoryto JaCoCo multi-release JAR excludes incoverage/pom.xml(same issue as existingCamelThreadFactoryexclude)Details
The infrastructure for coverage was already in place:
parent/pom.xml: JaCoCoprepare-agentconfigured in surefire/failsafe (activated by-Dcoverage)coverage/pom.xml:report-aggregategoal collects execution data across modules (activated by-Dcoverage)pom.xml:sonar.coverage.jacoco.xmlReportPathspoints to the aggregated reportThe only missing piece was actually running tests with
-Dcoveragein the sonar build workflow.Currently scoped to core modules only. Component coverage will be added as a follow-up once #22247 lands, by reusing
incremental-build.shmodule detection.Test plan