Ivy のサンプルを実行してみる
Ivy (アイビー)は、Javaライブラリの依存関係を解決してくれるツール。すでに ant を利用していて今更 maven には切り替えられないプロダクトに適用するといいだろう。
インストールのページに以下のような説明があった。
If you use ant 1.6.0 or superior, you can then simply go to the src/example/hello-ivy dir and run ant: if the build is successful, you have successfully installed Ivy !
サンプルの hello-ivy を ant でビルドしてみる。
$ tar xzf apache-ivy-2.0.0-beta1-bin.tar.gz
$ cd apache-ivy-2.0.0-beta1/src/example/hello-ivy
$ ant
resolve:
BUILD FAILED
どうやら失敗したらしい。何やらメッセージが表示された。
This appears to be an antlib declaration. Action: Check that the implementing library exists in one of: -/usr/share/ant/lib -/home/okinaka/.ant/lib -a directory added on the command line with the -lib argument
jar ファイルを2つほど ~/.ant/lib にコピーして、ant を実行。
$ mkdir -p ~/.ant/lib $ cp ../../../ivy-{,core-}2.0.0-beta1.jar ~/.ant/lib $ ant
今度はビルドがとおって、build ディレクトリに成果物の Hello.class が作成され、
lib のなかに依存するライブラリが作成されていた。