とりあえず MySQL Connector/J 6.0 をビルドする

MySQL :: MySQL Connector/J 6.0 Developer Guide :: 4.4 Installing from the Development Source Tree

$ git clone -b release/6.0 git@github.com:mysql/mysql-connector-j.git

lib というディレクトリがあるので、最低限必要なものとして hibernate4 を ダウンロードしてきて展開して、中にある lib の jar を含むディレクトリをそのまま lib 以下に設置する。ant dist するだけなら hibernate4 だけがあればよさそう。(動くかは知らない)

$ tar zxvf hibernate-release-4.2.21.Final.tgz
$ ls hibernate-release-4.2.21.Final/lib
envers   jpa      optional osgi     required
$ mkdir /path/to/mysql-connector-j/lib/hibernate4
$ mv hibernate-release-4.2.21.Final/lib/* /path/to/mysql-connector-j/lib/hibernate4

ちなみに mysql-connecotor-j/lib 以下に直接展開すると関係ないファイルが邪魔してビルドに失敗する。

そして以下のように実行する。JAVA_HOME は設定されてなければ自分で設定する。

$ ant dist -Dcom.mysql.cj.build.jdk=$JAVA_HOME

Intellij IDEA 上で Ant の Run Configuration から起動する場合はなぜか文字コードが変になるので下記のように javac のところに encoding="utf8" が必要になる。

diff --git a/build.xml b/build.xml
index a6ba44c..beffab7 100644
--- a/build.xml
+++ b/build.xml
@@ -814,7 +814,8 @@ See also com.mysql.cj.core.conf.PropertyDefinitions.SYSP_* variables for other t
                fork="yes"
                executable="${com.mysql.cj.build.jdk.javac}"
                compiler="modern"
-               includeantruntime="false">
+               includeantruntime="false"
+               encoding="utf8">
             <include name="**/*.java" />
             <exclude name="testsuite/**" />
             <exclude name="com/mysql/cj/jdbc/integration/**" />

とりあえず 5.1 とは違ってちゃんとビルドできる。すばらしい。以上。