JRuby-based gems that depend on other Java JAR files should ideally not ship those jars in the gem, for several reasons:
- The gem size will be greatly increased.
- Gems with conflicting copies of the same jars will cause errors if loaded at the same time.
- Jars should be sourced from the canonical source, Maven.
As part of the WASM work done by Claude in #2998, it appears that all of the related jars are now being shipped in the gem, under lib/rbs/wasm/jars. This adds almost 1MB of size to the released gem.
For this purpose, such gems use jar-dependencies, included with JRuby, to fetch jars from Maven as part of the gem installation. This guarantees that all libraries use the same canonical source (Maven) and do not load conflicting versions (because everyone should go through jar-dependencies which is aware of those versions).
See Psych for an example of a gem that uses jar-dependencies (in that case to fetch the jar for SnakeYAML Engine).
JRuby-based gems that depend on other Java JAR files should ideally not ship those jars in the gem, for several reasons:
As part of the WASM work done by Claude in #2998, it appears that all of the related jars are now being shipped in the gem, under lib/rbs/wasm/jars. This adds almost 1MB of size to the released gem.
For this purpose, such gems use jar-dependencies, included with JRuby, to fetch jars from Maven as part of the gem installation. This guarantees that all libraries use the same canonical source (Maven) and do not load conflicting versions (because everyone should go through jar-dependencies which is aware of those versions).
See Psych for an example of a gem that uses jar-dependencies (in that case to fetch the jar for SnakeYAML Engine).