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.

  1. Install a couple of dependencies:
    # apk update && apk upgrade
    # apk add git gcc make openjdk8 maven
    # apk add perl curl unzip bash musl-dev
  2. Set up JAVA_HOME:
    # export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
  3. Clone sqlite-jdbc repository:
    # git clone
  4. Build the shared object library and the JNI bindings:
    # cd sqlite-jdbc
    # make jni-header native
  5. Build the JAR (some tests don't pass, you have to skip them):
    # mvn -Dmaven.test.skip=true package
  6. The jar that is produced is in the target directory:
    # ls target/sqlite-jdbc*
  7. 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')
écrivain et éditeur

Après plusieurs vies, j’écris maintenant