Skip to content

(jsr-353) Re-enable test suite by running tests from class path - #97

Merged
cowtowncoder merged 1 commit into
FasterXML:3.xfrom
pjfanning:enable-jsr353-tests
Sep 10, 2026
Merged

(jsr-353) Re-enable test suite by running tests from class path#97
cowtowncoder merged 1 commit into
FasterXML:3.xfrom
pjfanning:enable-jsr353-tests

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Problem

jsr-353 has had <skipTests>true</skipTests> since 18-Jan-2025. The reason is recorded in the pom: the JSON-P 1.1 RI (org.glassfish:javax.json) declares Automatic-Module-Name: java.json, the same name as the API module (javax.json:javax.json-api), so both cannot be read on the module path. With the RI dropped, every test errors at class-init:

javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
	at java.json/javax.json.spi.JsonProvider.provider(JsonProvider.java:99)
	at tools.jackson.datatype.jsr353.JSR353Module.<init>(JSR353Module.java:25)

So the module has shipped with zero executed tests for over a year. That is how the JsonPatch START_ARRAY guard could sit here with tests that never ran while its jakarta twin silently lacked the fix (#92).

Fix

The clashing Automatic-Module-Name only matters on the module path. Run the tests from the class path instead:

<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <useModulePath>false</useModulePath>
  </configuration>
</plugin>

and restore the test-scoped org.glassfish:javax.json dependency.

Main sources are still compiled on the module path, so module-info.java's requires java.json is still validated — this only changes how tests execute.

Result

26 tests run and pass, where 0 ran before:

[INFO] Running tools.jackson.datatype.jsr353.JsonPatchDeserializationTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
...
[INFO] Tests run: 26, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS

mvn verify on the module also passes: jar builds, SBOM generates. One benign warning remains during test compilation, which is exactly the collision being side-stepped:

[WARNING] Can't extract module name from javax.json-1.1.4.jar: Module 'java.json' is already on the module path!

Full reactor is green (jsr-353 26, joda-money 95, json-org 12, jakarta-jsonp 23, jakarta-mail 7, javax-money 135, moneta 137).

If you would rather retire the module than maintain it, that is obviously a fine outcome too — but while it ships, having the suite actually run seems worth it.

Tests were disabled in 18-Jan-2025 because the JSON-P 1.1 RI
(`org.glassfish:javax.json`) declares Automatic-Module-Name "java.json" -- the
same name as the API module (`javax.json:javax.json-api`) -- so the two cannot
both be read on the module path:

    javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found

The module name only matters on the module path, so tell surefire to run from
the class path instead (`useModulePath=false`) and restore the test-scoped RI
dependency. Main sources are still compiled on the module path, so the
`module-info.java` `requires java.json` is still validated.

This brings back 26 tests that have not run since Jan 2025 -- including
`JsonPatchDeserializationTest` and `ModuleSPIMetadataTest`. All pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cowtowncoder
cowtowncoder merged commit 8e717a7 into FasterXML:3.x Sep 10, 2026
3 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.

2 participants