How to build Xerial's sqlite JDBC driver on Alpine Linux
These are the steps I took to build the sqlite JDBC driver so that it works on a musl-based Linux distro, namely Alpine Linux.
- Install a couple of dependencies:
# apk update && apk upgrade # apk add git gcc make openjdk8 maven # apk add perl curl unzip bash musl-dev
- Set up JAVA_HOME:
# export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
- Clone sqlite-jdbc repository:
# git clone https://github.com/xerial/sqlite-jdbc.git
- Build the shared object library and the JNI bindings:
# cd sqlite-jdbc # make jni-header native
- Build the JAR (some tests don't pass, you have to skip them):
# mvn -Dmaven.test.skip=true package
- The jar that is produced is in the target directory:
# ls target/sqlite-jdbc* target/sqlite-jdbc-3.16.2-SNAPSHOT.jar
- To use it in a gradle build, mkdir a lib directory in your gradle project, copy into it the jar that was built as above and add the following compile line to build.gradle:
compile fileTree(dir: 'lib', include: '**/*.jar')