From 033c2b8348636ba94af9c11fbec641324bfd231e Mon Sep 17 00:00:00 2001 From: EoD <293499+EoD@users.noreply.github.com> Date: Fri, 2 May 2025 19:51:18 +0000 Subject: [PATCH] use jarJar to embed the JDBC driver This does not cause conflicts with other mods that do the same and it reduces the dependency on the "jdbc mods" that are out there. --- build.gradle | 6 +++++- gradle.properties | 4 ++++ src/main/templates/META-INF/mods.toml | 8 -------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index cb9333e..783a8b9 100644 --- a/build.gradle +++ b/build.gradle @@ -136,7 +136,6 @@ dependencies { // We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it // modLocalRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}" compileOnly "curse.maven:curios-309927:5266541" - runtimeOnly "curse.maven:MySQL-561280:4684944" compileOnly "curse.maven:sophisticated-backpacks-422301:6303388" compileOnly "curse.maven:sophisticated-core-618298:6317048" @@ -151,6 +150,11 @@ dependencies { // Example project dependency using a sister or child project: // modImplementation project(":myproject") + // embedd the JDBC driver in the mod using jarJar + runtimeOnly "com.mysql:mysql-connector-j:${jdbc_version}" + jarJar "com.mysql:mysql-connector-j:${jdbc_version}" + additionalRuntimeClasspath "com.mysql:mysql-connector-j:${jdbc_version}" + // For more info: // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html diff --git a/gradle.properties b/gradle.properties index 812e9c0..892d137 100644 --- a/gradle.properties +++ b/gradle.properties @@ -43,3 +43,7 @@ mod_group_id=vip.fubuki.playersync mod_authors=mlus # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. mod_description=make multiserver players' data sync + + # JDBC driver version + # see https://dev.mysql.com/doc/relnotes/connector-j/en/ for latest version + jdbc_version=9.3.0 diff --git a/src/main/templates/META-INF/mods.toml b/src/main/templates/META-INF/mods.toml index c66514d..f239621 100644 --- a/src/main/templates/META-INF/mods.toml +++ b/src/main/templates/META-INF/mods.toml @@ -80,14 +80,6 @@ description='''${mod_description}''' ordering="NONE" side="BOTH" -# Dependency for MySQL -[[dependencies.${mod_id}]] - modId="mysql_jdbc" - mandatory=true - versionRange="[8.0.33+20230506,)" - ordering="NONE" - side="SERVER" - # Features are specific properties of the game environment, that you may want to declare you require. This example declares # that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't # stop your mod loading on the server for example.