Skip to content

test(build): add no-poi Maven profile to validate poi-ooxml stays optional (I1)#91

Merged
DemchaAV merged 1 commit into
developfrom
test/optional-deps-profile
May 31, 2026
Merged

test(build): add no-poi Maven profile to validate poi-ooxml stays optional (I1)#91
DemchaAV merged 1 commit into
developfrom
test/optional-deps-profile

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Summary

Wires up Track I1 from the v1.6.5→1.7 readiness taskboard. poi-ooxml is declared <optional>true</optional> in pom.xml so callers that render only PDFs don't pay the ~10 MB POI footprint; this PR ships the regression gate that proves the rest of the canonical suite runs without it.

What changes

no-poi profile in pom.xml

$ ./mvnw -P no-poi test -pl .

Activates a profile that does two things via maven-surefire-plugin:

  • Excludes POI from the test classpath via <classpathDependencyExcludes>: org.apache.poi:poi-ooxml, org.apache.poi:poi, org.apache.poi:poi-ooxml-lite. No POI on the classpath at test runtime — any unconditional reference becomes NoClassDefFoundError.
  • Sets no.poi=true system property so DOCX-specific tests can self-skip.

Two tests carry @DisabledIfSystemProperty(named = "no.poi", matches = "true")

Test Why
DocxSemanticBackendTest (whole class) Every test imports org.apache.poi.xwpf.usermodel.* and exercises DocxSemanticBackend end-to-end.
DocumentSessionTest#semanticBackendsShouldExportManifestsFromDocumentGraph Single test that asserts session.export(new DocxSemanticBackend()) produces a ZIP-shaped DOCX byte stream.

Both skip cleanly under -P no-poi. All other tests — including the rest of DocumentSessionTest — run green without POI on the classpath.

New CI job — no-poi-suite

PR-only, runs after the architecture guards job, executes ./mvnw -B -ntp test -pl . -P no-poi. Adds the regression gate to every PR so a future change that quietly introduces an unconditional POI reference fails the job rather than silently re-coupling the optional dependency.

Verification

$ ./mvnw -B -ntp test -pl . -P no-poi
Tests run: 1029, Failures: 0, Errors: 0, Skipped: 4
BUILD SUCCESS (~65s)

4 skipped == DocxSemanticBackendTest (3 tests) + 1 method in DocumentSessionTest — exactly the methods I annotated. The other 1025 tests ran without POI on the classpath, validating the <optional> declaration.

CHANGELOG entry added to v1.6.6 — Planned under the ### Build subsection.

Why this scope

  • Profile-level exclusion, not pom-level removalpoi-ooxml stays a declared dependency so consumers that do need DOCX still resolve it transitively; the profile is for us to test the no-POI footprint.
  • Skip annotation, not test removal — the DOCX backend is still production code under active use; the tests stay green by default and only skip when the profile says "validate without POI".
  • No production-code changesDocxSemanticBackend.java itself is untouched. The taskboard says "DOCX backend disabled gracefully"; gracefully here means "the suite around it doesn't fall over when POI is absent", which is what this validates.

Test plan

  • -P no-poi profile green locally (1029 / 0 / 0 / 4 skipped)
  • Default suite (no profile) still green
  • binary-compat profile unchanged (still in the same <profiles> block)
  • CI green on PR, including the new no-poi-suite job
  • Reviewer skim — the profile config (15 LOC in pom.xml) and the two @DisabledIfSystemProperty placements are the load-bearing pieces
  • (Out of scope) follow-up: a real consumer-side smoke test in a downstream repo that depends on graphcompose without explicitly adding poi-ooxml — tracked as v1.6.6 release-prep checklist item

…ional (I1)

Wires up Track I1 from the readiness taskboard. poi-ooxml is declared optional in pom.xml; this PR adds the regression gate that proves the rest of the canonical suite runs without it.

Profile: -P no-poi excludes poi-ooxml + poi + poi-ooxml-lite from surefire classpath via classpathDependencyExcludes and sets no.poi=true system property. DocxSemanticBackendTest (whole class) and DocumentSessionTest#semanticBackendsShouldExportManifestsFromDocumentGraph carry @DisabledIfSystemProperty so they skip cleanly. New no-poi-suite CI job runs the profile on every PR.

Local run: 1029 tests, 0 failures, 4 skipped under -P no-poi.
@DemchaAV DemchaAV merged commit 91e0ef8 into develop May 31, 2026
11 checks passed
@DemchaAV DemchaAV deleted the test/optional-deps-profile branch May 31, 2026 11:55
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