HiveをEclipse使って開発しようとするとき、こちらのページには以下のようにしましょうねと書いてあるのですが、
$ ant clean package eclipse-files $ cd metastore $ ant model-jar $ cd ../ql $ ant gen-test
最後の ant gen-test を実行すると、以下のエラーが発生します。(trunkのrev 1293919で確認)
BUILD FAILED /home/tamtam/work/hive-trunk/ql/build.xml:116: Problem: failed to create task or type if Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any <presetdef>/<macrodef> declarations have taken place.
<if>というタスクが無いよーというエラーです。 ${hive.root}/testlibs/ant-contrib-1.0b3.jar このJARファイルのIfTaskは中に入っており、build.xml中でtaskdefしてあげないといけません。以下の定義を追加してあげる必要があります。${hive.root}/build.xmlには定義されているんですけどね。。
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${hive.root}/testlibs/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
この定義をql/build.xmlのgen-testのtarget配下に書いてもいいのですが、いろんなbuild.xmlがbuild-common.xmlをimportしていて、さらにbuild-common.xmlでも<if>タスクを使っているので、build-common.xmlに定義するのが良いかと思います。
diffはこんな感じです。
Index: build-common.xml
===================================================================
--- build-common.xml (リビジョン 1293919)
+++ build-common.xml (作業コピー)
@@ -89,6 +89,12 @@
</condition>
<import file="build-offline.xml"/>
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties">
+ <classpath>
+ <pathelement location="${hive.root}/testlibs/ant-contrib-1.0b3.jar"/>
+ </classpath>
+ </taskdef>
+
<!--this is the naming policy for artifacts we want pulled down-->
<property name="ivy.artifact.retrieve.pattern" value="[conf]/[artifact]-[revision](-[classifier]).[ext]"/>
つか、誰も困って無いのかな・・。
それっぽいチケットも無いんだけど。