Skip to content

CAMEL-23274: Enable JaCoCo coverage in SonarCloud PR analysis#22468

Merged
gnodet merged 1 commit into
apache:mainfrom
gnodet:sonar-coverage-core
Apr 7, 2026
Merged

CAMEL-23274: Enable JaCoCo coverage in SonarCloud PR analysis#22468
gnodet merged 1 commit into
apache:mainfrom
gnodet:sonar-coverage-core

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Apr 7, 2026

CAMEL-23274

Summary

  • The SonarCloud PR analysis always reported 0% coverage because sonar-build.yml built with -Dquickly (skipping all tests) and never activated the -Dcoverage profile
  • Add a Maven step in sonar-build.yml that runs core module tests with -Dcoverage and 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 (~2452 classes across 13 modules)
  • Add ContextValueFactory to JaCoCo multi-release JAR excludes in coverage/pom.xml (same issue as existing CamelThreadFactory exclude)

Details

The infrastructure for coverage was already in place:

  • parent/pom.xml: JaCoCo prepare-agent configured in surefire/failsafe (activated by -Dcoverage)
  • coverage/pom.xml: report-aggregate goal collects execution data across modules (activated by -Dcoverage)
  • Root pom.xml: sonar.coverage.jacoco.xmlReportPaths points to the aggregated report

The only missing piece was actually running tests with -Dcoverage in 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.sh module detection.

Test plan

  • Tested locally: produces a 12 MB aggregated report with ~63% line coverage across 2452 classes in 13 core modules
  • Verify SonarCloud picks up the coverage data on this PR's analysis

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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

@gnodet gnodet merged commit 01a1627 into apache:main Apr 7, 2026
9 checks passed
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

Successfully merging this pull request may close these issues.

1 participant