私たちのプロジェクトには、すべての ant ファイルに含まれるcommon.xmlがあります。このcommon.xmlには、プロジェクトで使用するすべての一般的なタスクが含まれています。
最近、プロジェクトで ant-contrib を使用したいと考えました。そのため、 common.xmlに次のタスク定義を含めました。
<project name="CommonTasks" basedir="." xmlns:ac="antlib:net.sf.antcontrib">
<taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml>
<classpath>
<pathelement location="/usr/lib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
</project>
build.xmlの 1 つに、次のコードがあります。
<project name="Build" basedir=".">
<import file="common.xml" />
<ac:if>
<ac:not>
<isset property="android.available" />
</ac:not>
<ac:then>
<echo message="android is not available" />
</ac:then>
</ac:if>
</project>
ここで、名前空間がcommon.xmlで定義されているため、同じものがbuild.xmlにインポートされると想定しました。しかし、これは起こっていません。代わりに、私のbuild.xmlにxmlns:ac="antlib:net.sf.antcontrib"を含める必要があります。つまり、私のbuild.xmlは以下のようになります
<project name="Build" basedir="." xmlns:ac="antlib:net.sf.antcontrib">
<import file="common.xml" />
<ac:if>
<ac:not>
<isset property="android.available" />
</ac:not>
<ac:then>
<echo message="android is not available" />
</ac:then>
</ac:if>
</project>
すべてのbuild.xmlで同じ名前空間定義を定義する代わりに、すべてのbuild.xmlでこの名前空間のインポートを行う方法はありますか?