jarJar: declare version ranges for MySQL + HikariCP

Enables co-installation with arcadia-lib2 which embeds
  HikariCP in [5.1.0, 6.0.0)
  mysql-connector-j in [8.3.0, 9.0.0)

Before: PlayerSync declared its embedded libs with no range, only the
exact version (9.3.0 / 5.1.0). When another mod declared a range that
did not include our exact version, NeoForge's jarJar resolver had no
valid overlap and would either refuse to load or arbitrary-pick one
version, risking runtime breakage.

After:
  - mysql-connector-j: strictly [8.3.0, 10.0.0), prefer 9.3.0.
    Intersects arcadia-lib's [8.3.0, 9.0.0) — resolver picks 8.3.0
    when both mods are present. 8.3.0 and 9.3.0 share the same
    Connection / PreparedStatement / ResultSet APIs we actually use,
    so downgrade is safe.
  - HikariCP: strictly [5.1.0, 6.0.0), prefer 5.1.0. Identical to
    arcadia-lib's declared range — shared single instance.

No code changes — only the metadata shipped in META-INF/jarjar/metadata.json.
Verified via unzip -p that the range is correctly emitted.
This commit is contained in:
laforetbrut 2026-04-22 06:46:24 +02:00
parent d818794a20
commit 2361ffb272

View File

@ -137,17 +137,32 @@ dependencies {
runtimeOnly "curse.maven:curios-309927:6529130"
runtimeOnly "curse.maven:sophisticated-backpacks-422301:7169832"
runtimeOnly "curse.maven:sophisticated-core-618298:7168230"
// embedd the JDBC driver in the mod using jarJar
// Embed the JDBC driver in the mod using jarJar.
// FIX COMPAT: declare a version RANGE so multi-mod setups (eg. arcadia-lib which
// requires [8.3.0, 9.0.0)) can resolve a single shared MySQL driver instance
// without jarJar complaining about incompatible constraints. The `prefer` keeps
// 9.3.0 as our baseline when PlayerSync is the only consumer.
runtimeOnly "com.mysql:mysql-connector-j:${jdbc_version}"
jarJar "com.mysql:mysql-connector-j:${jdbc_version}"
jarJar("com.mysql:mysql-connector-j") {
version {
strictly "[8.3.0, 10.0.0)"
prefer "${jdbc_version}"
}
}
additionalRuntimeClasspath "com.mysql:mysql-connector-j:${jdbc_version}"
// HikariCP connection pool eliminates isValid() ping on every query (no more pingInternal in Spark)
// Exclude slf4j-api: NeoForge already ships it
// Exclude slf4j-api: NeoForge already ships it.
// FIX COMPAT: declare a range matching arcadia-lib's [5.1.0, 6.0.0) so jarJar
// resolution succeeds with a single shared instance.
implementation("com.zaxxer:HikariCP:${hikari_version}") {
exclude group: "org.slf4j", module: "slf4j-api"
}
jarJar("com.zaxxer:HikariCP:${hikari_version}") {
jarJar("com.zaxxer:HikariCP") {
version {
strictly "[5.1.0, 6.0.0)"
prefer "${hikari_version}"
}
exclude group: "org.slf4j", module: "slf4j-api"
}
additionalRuntimeClasspath("com.zaxxer:HikariCP:${hikari_version}") {