kevin
06/05/2024, 7:17 PM[versions]
sqLiteVersion = "3.45.3.0"
logback_version = "1.5.6"
[libraries]
sqlite = { module = "org.xerial:sqlite-jdbc", version.ref = "sqLiteVersion" }
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback_version" }
I also reference these in my build.gradle file
desktopMain.dependencies {
implementation(libs.logback)
implementation(libs.sqlite)
}
In main
I add code to access a database
val connectionString = "jdbc:sqlite:${databaseDirectory}foo.sqlite"
val connection = DriverManager.getConnection(connectionString)
val stmt = connection.createStatement()
val rs = stmt.executeQuery("select * from competitions")
while (rs.next()) {
println(rs.getString("id"))
}
If I run the app, this all works.
If I use compose desktop:runDistributable
then it also works.
What I then do is add a logback.xml file to desktopMain/resources and then try and run compose desktop:runDistributable
then I get an exception
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:sqlite:/Users/kevinjones/.ksstats/cricket.sqlite
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
at ComposableSingletons$MainKt$lambda-2$1.invoke(main.kt:16)
at ComposableSingletons$MainKt$lambda-2$1.invoke(main.kt:6)
...
If I take that logback.xml file and remove all its contents then everything works again.
If the logback.xml file simply contains
<configuration>
</configuration>
then it fails, so there’s nothing in this file that causes an error.
I’ve tried various combinations of putting the references to logback and sqlite in different source sets, and putting logback.xml in different source sets but the error persists.
This is on an Apple Silicon Mac.kevin
06/06/2024, 4:17 PMincludeAllModules = true
in the gradle file also fixed the code using logback, unfortunately there’s no hint as to what modules I also need to include (suggestRuntimeModules
doesn’t help)
Is there any other way of getting the modules I need for the application?Ahmed Riyadh
06/07/2024, 9:47 PMjava.sql
module, and you might also need to update Proguard rulesAhmed Riyadh
06/07/2024, 9:49 PMjdeps
or try to build the release application with the warnings, you will know from the java imports, including all modules will make the distributable app bundle biggerAhmed Riyadh
06/08/2024, 1:23 AM